2
  • NPM Version: 5.6.0
  • Node Version: 8.11.4
  • Windows 10: Powershell (VS Code terminal)

When I run the npm audit task in Powershell I get a prompt asking "Did you mean this? Edit"

I am running in the root directory of my project (with the package.json file) and other npm commands work as expected.

It appears that the command is not recognised. From what I can see in the documentation: https://docs.npmjs.com/cli/audit this should work out of the box without any other packages.

Antfish
  • 1,313
  • 2
  • 22
  • 41

1 Answers1

3

The npm audit command was added in npm v6. [1]

Node.js v10.3.0 was the first Node version to bundle npm v6 with it. Upgrading to Node v10.3.0 or later will get you npm v6 and npm audit support.

You can also upgrade your npm version independently of your Node.js version by running npm install -g npm. [2]

RyanZim
  • 6,609
  • 1
  • 27
  • 43
  • This definitely looks like the issue. My only confusion is that I was able to do this until recently. I can only assume that I overrode my NPM installation with NPM ~6 but not my Node installation. Then, subsequently did a minor update to my Node version using NVM this then overwrote the NPM version back below 6. – Antfish Oct 01 '18 at 07:51
  • Yeah, if you installed a different Node version, your npm version will probably change. – RyanZim Oct 01 '18 at 14:20
  • Dont forget to reopen your terminal :) – Guchelkaben Apr 16 '19 at 06:05