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

[BUG] npm/node don't respect each other's versions #6836

Open
2 tasks done
josh-m-sharpe opened this issue Sep 25, 2023 · 4 comments · May be fixed by #7876
Open
2 tasks done

[BUG] npm/node don't respect each other's versions #6836

josh-m-sharpe opened this issue Sep 25, 2023 · 4 comments · May be fixed by #7876
Assignees
Labels
Bug thing that needs fixing Priority 2 secondary priority issue Release 9.x work is associated with a specific npm 9 release Release 10.x

Comments

@josh-m-sharpe
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

Edit: I am not using the latest npm....

If you install Node 16. Yes. Sixteen, in 2023. It will install npm v8.something.

It will then say this:

npm notice New major version of npm available! 8.19.4 -> 10.1.0

This is categorically untrue. npm 10x is not compatible with node 16. And if you install npm 10 insanity breaks out. Things don't work, and node do-do-doos along as if everything is peachy keen when it, in fact, is not.

This strikes me as a breakdown in node or npm's version management.

Expected Behavior

node/npm wouldn't suggest incompatible versions.

Steps To Reproduce

  1. install node16.
  2. get jiggy with node16 and do what it says - update to npm 10.
  3. Watch everything break

Environment

  • npm: 8.something
  • Node.js: 16
  • OS Name:
  • System Model Name:
  • npm config:
; copy and paste output from `npm config ls` here
@josh-m-sharpe josh-m-sharpe added Bug thing that needs fixing Needs Triage needs review for next steps Release 10.x labels Sep 25, 2023
@josh-m-sharpe
Copy link
Author

josh-m-sharpe commented Sep 25, 2023

To be clear, not asking for anyone to fix node 16.

Think we should fix latest versions of things to properly manage version dependencies.

@lukekarrys
Copy link
Contributor

I think the solution here would be to change our update-notifier to follow the same logic we do when attempting to install npm@latest -g:

cli/lib/commands/install.js

Lines 109 to 127 in 6500218

const npmInstall = args.find(arg => arg.startsWith('npm@') || arg === 'npm')
if (isGlobalInstall && npmInstall) {
const npmOptions = this.npm.flatOptions
const npmManifest = await pacote.manifest(npmInstall, npmOptions)
try {
checks.checkEngine(npmManifest, npmManifest.version, process.version)
} catch (e) {
if (forced) {
log.warn(
'install',
/* eslint-disable-next-line max-len */
`Forcing global npm install with incompatible version ${npmManifest.version} into node ${process.version}`
)
} else {
throw e
}
}
}

This will likely never make it into npm@8 and fix this specific case, but we can help future major versions of node and npm avoid this problem.

@lukekarrys lukekarrys added Priority 2 secondary priority issue and removed Needs Triage needs review for next steps labels Sep 26, 2023
@josh-m-sharpe
Copy link
Author

This will likely never make it into npm@8 and fix this specific case, but we can help future major versions of node and npm avoid this problem.

👍

@Voltra
Copy link

Voltra commented Sep 27, 2023

Looks to me like the engine part is just not taken into account, which is surprising since the code seems to indicate otherwise

@lukekarrys lukekarrys added the Release 9.x work is associated with a specific npm 9 release label Oct 6, 2023
@milaninfy milaninfy linked a pull request Oct 23, 2024 that will close this issue
2 tasks
@milaninfy milaninfy self-assigned this Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 2 secondary priority issue Release 9.x work is associated with a specific npm 9 release Release 10.x
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants