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 v11.1.0 does not work on Node v22.13.1 despite saying it should #8094

Closed
2 tasks done
Fishrock123 opened this issue Feb 10, 2025 · 2 comments
Closed
2 tasks done
Labels
Bug thing that needs fixing Needs Triage needs review for next steps

Comments

@Fishrock123
Copy link
Contributor

Fishrock123 commented Feb 10, 2025

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

Take what you will from this. I was unable to upgrade my npm or do anything. It appears this is still the latest version of npm 11 and the latest version of node 22 at time of writing.

Running any npm install command results in:

npm version patch -m "chore(patch): release %s"
ERROR: npm v11.1.0 is known not to run on Node.js v22.13.1.  This version of npm supports the following node versions: `^20.17.0 || >=22.9.0`. You can find the latest version at https://nodejs.org/.

ERROR:
/Users/jsenkpiel/Library/Application Support/fnm/node-versions/v22.13.1/installation/lib/node_modules/npm/node_modules/semver/classes/semver.js:303



SyntaxError: Invalid or unexpected token
    at wrapSafe (node:internal/modules/cjs/loader:1512:18)
    at Module._compile (node:internal/modules/cjs/loader:1534:20)
    at Object..js (node:internal/modules/cjs/loader:1699:10)
    at Module.load (node:internal/modules/cjs/loader:1313:32)
    at Function._load (node:internal/modules/cjs/loader:1123:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Module.require (node:internal/modules/cjs/loader:1335:12)
    at require (node:internal/modules/helpers:136:16)
    at Object.<anonymous> (/Users/jsenkpiel/Library/Application Support/fnm/node-versions/v22.13.1/installation/lib/node_modules/npm/node_modules/semver/functions/compare.js:1:16)

The actual error is also very unhelpful.

Invalid or unexpected token

Which/what token?? Where?? I can't fix this even if I wanted to.


Temporarily resolved by wiping my node install in fnm and re-installing. (And not upgrading npm.)

Expected Behavior

npm functions as normal for any given command.

Steps To Reproduce

  1. Install Node.js stable (22.13.1).
  2. Run npm i -g npm.
  3. Try to run any npm install command.

Environment

  • npm: 11.0.1
  • Node.js: 22.13.1
  • OS Name: macOS Sequoia 15.2 (24C101)
  • System Model Name: MacBook Pro M4
  • npm config: (Note: taken after I wiped my install to make things work again.)
; "user" config from /Users/jsenkpiel/.npmrc

<internal artifactory>:_authToken = (protected)
<internal artifactory>:_authToken = (protected)
prefer-offline = true
progress = false
; registry = "<internal artifactory>" ; overridden by project

; "project" config from <internal project>

message = "chore(patch): release %s"
registry = "<internal artifactory>"
tag-version-prefix = ""

; node bin location = /Users/jsenkpiel/Library/Application Support/fnm/node-versions/v22.13.1/installation/bin/node
; node version = v22.13.1
; npm local prefix = <internal project>
; npm version = 10.9.2
; cwd = <internal project>
; HOME = /Users/jsenkpiel
; Run `npm config ls -l` to show all defaults.
@Fishrock123 Fishrock123 added Bug thing that needs fixing Needs Triage needs review for next steps labels Feb 10, 2025
@milaninfy
Copy link
Contributor

milaninfy commented Feb 11, 2025

Here is my output of running series of steps and I can't reproduce the error. It might have something to do with your installation.

~/workarea/rep $ npm -v    
11.1.0
~/workarea/rep $ node -v
v22.13.1
~/workarea/rep $ npm init -y
Wrote to /Users/milaninfy/workarea/rep/package.json:

{
  "name": "rep",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "type": "commonjs",
  "devDependencies": {
    "@actions/core": "^1.11.1"
  }
}



~/workarea/rep $ npm install lodash

added 8 packages, and audited 9 packages in 1s

found 0 vulnerabilities
~/workarea/rep $ npm version patch -m "chore(patch): release %s"  
v1.0.1

@milaninfy
Copy link
Contributor

This is likely to be problem with your installation of node. Please check and fix installation if you are using node version managers like nvm, fnm etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps
Projects
None yet
Development

No branches or pull requests

2 participants