better-npm-audit icon indicating copy to clipboard operation
better-npm-audit copied to clipboard

Recommended "--omit=dev" option not found for NPM 8

Open RemcoBuddelmeijer opened this issue 3 years ago • 2 comments

Description When using NPM version >= 8 the --omit=dev option is not passed through.

Running the command better-npm-audit audit -p results in a warning by NPM advising you to use --omit=dev instead.

$ better-npm-audit audit -p
npm
 WARN config production Use `--omit=dev` instead.

However, when running said command better-npm-audit audit --omit=dev an error is spat out:

$ better-npm-audit audit --omit=dev
error: unknown option '--omit=dev'

Adding the option to better-npm-audit might be beneficial as currently it's producing warnings, but keeping the other option in for older NPM versions. Another solution could be to forward the -p option to execute --omit=dev for NPM 8.

Running npm audit --omit=dev works like a charm.

Context NPM version: 8.13.2 Node version: v16.15.1 Better NPM Audit version (through NPM): 3.7.3 Architecture: Aarch64

RemcoBuddelmeijer avatar Jul 13 '22 10:07 RemcoBuddelmeijer

I was on NPM 8.5.0 and did not receive this warning. Upgraded to 8.13.2 and now I get it as well. Seems to be a new warning (nowadays the --omit=dev flag is preferred over --production for the npm audit command)

Zenulous avatar Jul 13 '22 11:07 Zenulous

The pull request for this has been open for over a year. Is this project still being developed? Can anyone recommend alternatives?

jens-duttke avatar Jan 21 '24 08:01 jens-duttke