npm@7 brings fundamental changes to npx, which may break your CI process.
npm_config_yes=true npx <package_name>
npm@7 now uses
npm exec as an underline to npx. As a result, your terminal should wait for you to proceed with installation of uninstalled packages. (I’m “standard” as an example, but this applies for all).
npx standard -- --fix
This is a blocker for CI processes that may start to fail when migrating to npm@7.
The solution should be to use the underlined
—- yes option.
npx --yes standard --fix
Is equivalent to
npm exec standard --yes -- --fix
The issue with this solution is that npm@6 does not support this flag and will throw an error.
The solution that is compatible for both versions is to set an npm flag “npm_config_yes” which will get picked up by npm@7 and will be ignored by npm@6
npm_config_yes=true npx standard
You can create a fix on the environment without needing to edit your pipelines by setting the environment variable
Hope this helps