cli icon indicating copy to clipboard operation
cli copied to clipboard

[BUG] Unable to install 11.1.0 with corepack

Open jensenbox opened this issue 1 year ago • 16 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

This issue exists in the latest npm version

  • [x] I am using the latest npm

Current Behavior

We have tried with the the docker 22 release as well as locally but running:

corepack prepare npm@latest --activate

or corepack prepare [email protected] --activate

both fail with the same following error:

Preparing [email protected] for immediate activation...
Internal Error: Cannot find matching keyid: {"signatures":[{"sig":"MEYCIQCKqkTMp8Lr/s6dqmOOdG9bdpCWzPLUL3typxXxDW1gFwIhANdhRHLzpYGy2An4pE+1amOBppTlN1oqN72/PEzSZN1M","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"keys":[{"expires":null,"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","keytype":"ecdsa-sha2-nistp256","scheme":"ecdsa-sha2-nistp256","key":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE1Olb3zMAFFxXKHiIkQO5cJ3Yhl5i6UPp+IhuteBJbuHcA5UogKo0EWtlWwW6KSaKoTNEYL7JlCQiVnkhBktUgg=="}]}
    at verifySignature (/home/christian/.local/share/fnm/node-versions/v22.12.0/installation/lib/node_modules/corepack/dist/lib/corepack.cjs:21535:47)
    at installVersion (/home/christian/.local/share/fnm/node-versions/v22.12.0/installation/lib/node_modules/corepack/dist/lib/corepack.cjs:21882:7)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Engine.ensurePackageManager (/home/christian/.local/share/fnm/node-versions/v22.12.0/installation/lib/node_modules/corepack/dist/lib/corepack.cjs:22310:32)
    at async PrepareCommand.execute (/home/christian/.local/share/fnm/node-versions/v22.12.0/installation/lib/node_modules/corepack/dist/lib/corepack.cjs:23019:27)
    at async PrepareCommand.validateAndExecute (/home/christian/.local/share/fnm/node-versions/v22.12.0/installation/lib/node_modules/corepack/dist/lib/corepack.cjs:19835:22)
    at async _Cli.run (/home/christian/.local/share/fnm/node-versions/v22.12.0/installation/lib/node_modules/corepack/dist/lib/corepack.cjs:20772:18)
    at async Object.runMain (/home/christian/.local/share/fnm/node-versions/v22.12.0/installation/lib/node_modules/corepack/dist/lib/corepack.cjs:23091:19)

Expected Behavior

No error

Steps To Reproduce

  1. Ensure you have Node 22 installed
  2. run fnm exec corepack prepare [email protected] --activate

Environment

  • npm: 10.9.0
  • node: v22.12.0
  • OS Name: Linux Mint
  • npm config:
; node bin location = /home/christian/.local/share/fnm/node-versions/v22.12.0/installation/bin/node
; node version = v22.12.0
; npm local prefix = /home/christian/projects/test
; npm version = 10.9.0
; cwd = /home/christian/projects/test
; HOME = /home/christian
; Run `npm config ls -l` to show all defaults.

; "default" config from default values

_auth = (protected)
access = null
all = false
allow-same-version = false
also = null
audit = true
audit-level = null
auth-type = "web"
before = null
bin-links = true
browser = null
ca = null
cache = "/home/christian/.npm"
cache-max = null
cache-min = 0
cafile = null
call = ""
cert = null
cidr = null
color = true
commit-hooks = true
cpu = null
depth = null
description = true
dev = false
diff = []
diff-dst-prefix = "b/"
diff-ignore-all-space = false
diff-name-only = false
diff-no-prefix = false
diff-src-prefix = "a/"
diff-text = false
diff-unified = 3
dry-run = false
editor = "vi"
engine-strict = false
expect-result-count = null
expect-results = null
fetch-retries = 2
fetch-retry-factor = 10
fetch-retry-maxtimeout = 60000
fetch-retry-mintimeout = 10000
fetch-timeout = 300000
force = false
foreground-scripts = false
format-package-lock = true
fund = true
git = "git"
git-tag-version = true
global = false
global-style = false
globalconfig = "/home/christian/.local/share/fnm/node-versions/v22.12.0/installation/etc/npmrc"
heading = "npm"
https-proxy = null
if-present = false
ignore-scripts = false
include = []
include-staged = false
include-workspace-root = false
init-author-email = ""
init-author-name = ""
init-author-url = ""
init-license = "ISC"
init-module = "/home/christian/.npm-init.js"
init-version = "1.0.0"
init.author.email = ""
init.author.name = ""
init.author.url = ""
init.license = "ISC"
init.module = "/home/christian/.npm-init.js"
init.version = "1.0.0"
install-links = false
install-strategy = "hoisted"
json = false
key = null
legacy-bundling = false
legacy-peer-deps = false
libc = null
link = false
local-address = null
location = "user"
lockfile-version = null
loglevel = "notice"
logs-dir = null
logs-max = 10
; long = false ; overridden by cli
maxsockets = 15
message = "%s"
node-options = null
noproxy = [""]
npm-version = "10.9.0"
offline = false
omit = []
omit-lockfile-registry-resolved = false
only = null
optional = null
os = null
otp = null
pack-destination = "."
package = []
package-lock = true
package-lock-only = false
parseable = false
prefer-dedupe = false
prefer-offline = false
prefer-online = false
prefix = "/home/christian/.local/share/fnm/node-versions/v22.12.0/installation"
preid = ""
production = null
progress = true
provenance = false
provenance-file = null
proxy = null
read-only = false
rebuild-bundle = true
registry = "https://registry.npmjs.org/"
replace-registry-host = "npmjs"
save = true
save-bundle = false
save-dev = false
save-exact = false
save-optional = false
save-peer = false
save-prefix = "^"
save-prod = false
sbom-format = null
sbom-type = "library"
scope = ""
script-shell = null
searchexclude = ""
searchlimit = 20
searchopts = ""
searchstaleness = 900
shell = "/bin/bash"
shrinkwrap = true
sign-git-commit = false
sign-git-tag = false
strict-peer-deps = false
strict-ssl = true
tag = "latest"
tag-version-prefix = "v"
timing = false
umask = 0
unicode = true
update-notifier = true
usage = false
user-agent = "npm/{npm-version} node/{node-version} {platform} {arch} workspaces/{workspaces} {ci}"
userconfig = "/home/christian/.npmrc"
version = false
versions = false
viewer = "man"
which = null
workspace = []
workspaces = null
workspaces-update = true
yes = null

; "cli" config from command line options

long = true

jensenbox avatar Jan 30 '25 17:01 jensenbox

Relevant/related issues:

  • https://github.com/nodejs/corepack/issues/612
  • https://github.com/pnpm/pnpm/issues/9014

See also this https://github.com/nodejs/corepack/issues/616#issuecomment-2622079955 for the rundown. In particular:

The workarounds are to set the environment variable COREPACK_INTEGRITY_KEYS=0, to manually update to [email protected] or to install it using knowledge of the release's hash.

You can manually update corepack by running npm install -g corepack@latest.

(If you'd rather "install it using knowledge of the release's hash", see his other comment here: https://github.com/nodejs/corepack/issues/612#issuecomment-2622669686 : run npm view [email protected] dist.shasum to get the hash.)

LucienLeMagicien avatar Jan 31 '25 14:01 LucienLeMagicien

@jensenbox

You can use the same principle I found for pnpm. The following should unblock you:

SHA_SUM=$(npm view [email protected] dist.shasum)
corepack install -g [email protected]+sha1.$SHA_SUM

I'm completely new to this. So this really is just peer-to-peer support!

MikeMcC399 avatar Jan 31 '25 22:01 MikeMcC399

This not a bug w/ npm it was an issue w/ corepack. The newest version of corepack was updated and can now validate things signed w/ the latest npm registry key.

wraithgar avatar Jan 31 '25 23:01 wraithgar

It's also happening on npm version 20

djakielski avatar Feb 03 '25 07:02 djakielski

@djakielski

It's also happening on npm version 20

There is no npm version 20. Perhaps you mean Node.js 20?

Are you asking for help or just reporting your issue?

MikeMcC399 avatar Feb 03 '25 08:02 MikeMcC399

Same here by using nvm, node 22.13.1 in .nvmrc, and pnpm 9.15.5 in package.json :

nvm install
corepack prepare

Image

troyere avatar Feb 03 '25 08:02 troyere

What we did for now was in our Dockerfile

FROM node:20.18-bookworm AS base

# ... some of our configuration here

RUN install --owner=node --group=node --directory /src/frontend/${SUBDIR}/ /src/frontend/.pnpm-store/ \
- && corepack enable pnpm \ 
+ && npm i -g [email protected] \

# ... rest of our Dockerfile

This works for us, as corepack was only used to install pnpm, but it's a temporary workaround.

ghost avatar Feb 03 '25 08:02 ghost

@troyere

Same here by using nvm, node 22.13.1 in .nvmrc, and pnpm 9.15.5 in package.json :

nvm install corepack prepare Image

  • Your issue is discussed in https://github.com/nodejs/corepack/issues/612#issuecomment-2629496091

MikeMcC399 avatar Feb 03 '25 09:02 MikeMcC399

@ricardo-rumble

What we did for now was in our Dockerfile

FROM node:20.18-bookworm AS base

# ... some of our configuration here

RUN install --owner=node --group=node --directory /src/frontend/${SUBDIR}/ /src/frontend/.pnpm-store/ \
- && corepack enable pnpm \ 
+ && npm i -g [email protected] \

# ... rest of our Dockerfile

This works for us, as corepack was only used to install pnpm, but it's a temporary workaround.

This has the same root cause as the issue installing [email protected] with Corepack, however you are in the wrong issue list if your problem is with pnpm installation with Corepack.

I have however seen other users working around the issue in Docker with

&& npm install -g corepack@latest && corepack enable pnpm
  • The related Corepack issue is https://github.com/nodejs/corepack/issues/612

MikeMcC399 avatar Feb 03 '25 09:02 MikeMcC399

corepack enable && corepack prepare [email protected] --activate

It's work!!!

apichai1moby avatar Feb 03 '25 09:02 apichai1moby

corepack enable && corepack prepare [email protected] --activate

It's work!!!

Thanks @apichai1moby, I was able to resume my deployment coz of this.

uday-octanom avatar Feb 03 '25 09:02 uday-octanom

You can also store your preferred pnpm version in package.json:

"packageManager": "[email protected]"

Then in the CI script:

corepack enable
corepack prepare --activate

This way, you'll always use the same version of pnpm locally and on your CI.

0ctothorp avatar Feb 03 '25 12:02 0ctothorp

Hi folks.

For use folks running nixos whats the correct way to solve this ? i am getting a read only file system when i do corepack enable

❯ corepack enable
Internal Error: EROFS: read-only file system, symlink '../lib/node_modules/corepack/dist/pnpm.js' -> '/nix/store/fkyp1bm5gll9adnfcj92snyym524mdrj-nodejs-22.11.0/bin/pnpm'
    at async Object.symlink (node:internal/fs/promises:1001:10)
    at async EnableCommand.generatePosixLink (/nix/store/fkyp1bm5gll9adnfcj92snyym524mdrj-nodejs-22.11.0/lib/node_modules/corepack/dist/lib/corepack.cjs:22608:5)
    at async Promise.all (index 0)
    at async EnableCommand.execute (/nix/store/fkyp1bm5gll9adnfcj92snyym524mdrj-nodejs-22.11.0/lib/node_modules/corepack/dist/lib/corepack.cjs:22595:5)
    at async EnableCommand.validateAndExecute (/nix/store/fkyp1bm5gll9adnfcj92snyym524mdrj-nodejs-22.11.0/lib/node_modules/corepack/dist/lib/corepack.cjs:19835:22)
    at async _Cli.run (/nix/store/fkyp1bm5gll9adnfcj92snyym524mdrj-nodejs-22.11.0/lib/node_modules/corepack/dist/lib/corepack.cjs:20772:18)
    at async Object.runMain (/nix/store/fkyp1bm5gll9adnfcj92snyym524mdrj-nodejs-22.11.0/lib/node_modules/corepack/dist/lib/corepack.cjs:23091:19)

ymolists avatar Feb 03 '25 14:02 ymolists

@ymolists

That is quite a different issue and you should probably be asking your question in a separate issue in the https://github.com/nodejs/corepack/issues list to see if Corepack is supported in a NixOS environment, which is quite special. Or check the NixOS issues for guidance.

MikeMcC399 avatar Feb 03 '25 15:02 MikeMcC399

Since Corepack is being removed from Node, this issue gave me a reason to migrate away from it. Thanks to the contributors, and thanks for the memories!

duc-hoang-161 avatar Feb 03 '25 19:02 duc-hoang-161

npm i -g corepack fixed it for me

jerohero avatar Feb 07 '25 10:02 jerohero