npx breaking on CI?

npm@7 brings fundamental changes to npx, which may break your CI process.

TL;DR

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 npm exec —- 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

sysadmin

You can create a fix on the environment without needing to edit your pipelines by setting the environment variable

export npm_config_yes=true

Hope this helps

 by the author.

--

--

--

omrilotan.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Setting up React Project with Parcel zero configuration approach.

Big O in Simple Words

Quick Tips for Speeding up Those JavaScript Arrays

Understanding createSlice in Redux Toolkit — ReactJS.

JavaScript ES6 Amazing Topics

React Hooks — Part 2: {useEffect}

React and FastAPI Login System

Coding my comment section

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
omrilotan

omrilotan

omrilotan.com

More from Medium

Application Frameworks

TWIL: Deploying Node.js to Azure App Service with GitHub Actions

JWT Keys and RingCentral API Connections

Loop in Postman