Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support NPM 9.0.0 #52

Merged
merged 4 commits into from
Mar 21, 2023
Merged

Support NPM 9.0.0 #52

merged 4 commits into from
Mar 21, 2023

Conversation

dominicfraser
Copy link
Contributor

@dominicfraser dominicfraser commented Mar 17, 2023

Node 18.14.0 Docker images come paired with NPM 9.3.0 - the first update that brings in NPM v9.

Node + NPM pairings can be seen at: https://nodejs.org/dist/index.json

NPM 9.0.0 removes the npm bin command, that this repo is relying on.

The NPM release can be see at: https://github.com/npm/cli/releases/tag/v9.0.0

This PR works around this removal by switching to npm root and prepending /.bin. npm root is also available in older versions of NPM.

https://docs.npmjs.com/cli/v9/commands/npm-root?v=true
https://docs.npmjs.com/cli/v8/commands/npm-bin?v=true

@@ -79,7 +79,8 @@ const checkVersion = (engineName, command) => {
let localVersionValid = null;

try {
const localBinFolder = execSync('npm bin').toString().trim();
const localRootFolder = execSync('npm root').toString().trim();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous output would have been like:

/Users/dominicfraser/Documents/repos/my-repo/packages/common/node_modules/.bin'

The new output would be like

/Users/dominicfraser/Documents/repos/my-repo/packages/common/node_modules'

We take this then prepend /.bin below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been tested on NPM 8 and NPM 9, on local machine and in our CI.

@olliecurtis olliecurtis merged commit 0136f0a into Skyscanner:main Mar 21, 2023
@dominicfraser dominicfraser deleted the npm_9 branch March 21, 2023 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants