Error started today for an npm install.
Running into the below issue with the commitlint-pre-commit-hook:
[INFO] Installing environment for https://github.com/alessandrojcm/commitlint-pre-commit-hook.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/home/vscode/.cache/pre-commit/repoz1f94nsb/node_env-default/bin/node', '/home/vscode/.cache/pre-commit/repoz1f94nsb/node_env-default/bin/npm', 'pack')
return code: 254
stdout: (none)
stderr:
(node:2699) ExperimentalWarning: Support for loading ES Module in require() is an experimental feature and might change at any time
(Use node --trace-warnings ... to show where the warning was created)
npm warn tarball tarball data for file:/home/vscode/.cache/pre-commit/repoz1f94nsb/ (null) seems to be corrupted. Trying again.
npm warn tarball tarball data for file:/home/vscode/.cache/pre-commit/repoz1f94nsb/ (null) seems to be corrupted. Trying again.
npm error code ENOENT
npm error syscall lstat
npm error path /home/vscode/.cache/pre-commit/repoz1f94nsb/ode_env-default/lib/node_modules/npm/node_modules/sprintf-js/dist/.gitattributes
npm error errno -2
npm error enoent ENOENT: no such file or directory, lstat '/home/vscode/.cache/pre-commit/repoz1f94nsb/ode_env-default/lib/node_modules/npm/node_modules/sprintf-js/dist/.gitattributes'
npm error enoent This is related to npm not being able to find a file.
npm error enoent
npm error A complete log of this run can be found in: /home/vscode/.npm/_logs/2024-10-16T17_40_56_462Z-debug-0.log
even we have faced the same error.
Hey, could you please submit a repo where this happens? Thanks
[INFO] Installing environment for https://github.com/alessandrojcm/commitlint-pre-commit-hook.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/root/.cache/pre-commit/repowsykjq0q/node_env-default/bin/node', '/root/.cache/pre-commit/repowsykjq0q/node_env-default/bin/npm', 'pack')
return code: 254
stdout: (none)
stderr:
(node:14333) ExperimentalWarning: Support for loading ES Module in require() is an experimental feature and might change at any time
(Use node --trace-warnings ... to show where the warning was created)
npm warn tarball tarball data for file:/root/.cache/pre-commit/repowsykjq0q/ (null) seems to be corrupted. Trying again.
npm warn tarball tarball data for file:/root/.cache/pre-commit/repowsykjq0q/ (null) seems to be corrupted. Trying again.
npm error code ENOENT
npm error syscall lstat
npm error path /root/.cache/pre-commit/repowsykjq0q/ode_env-default/lib/node_modules/npm/node_modules/sprintf-js/dist/.gitattributes
npm error errno -2
npm error enoent ENOENT: no such file or directory, lstat '/root/.cache/pre-commit/repowsykjq0q/ode_env-default/lib/node_modules/npm/node_modules/sprintf-js/dist/.gitattributes'
npm error enoent This is related to npm not being able to find a file.
npm error enoent
npm error A complete log of this run can be found in: /root/.npm/_logs/2024-10-17T10_51_00_842Z-debug-0.log
Check the log at /root/.cache/pre-commit/pre-commit.log
Sorry but I meant a git repository that I can clone so I can debug the issue.
We have this repo being invoked from pipeline existing which is present within a private repo.
Ok gotcha, could you please then paste your pre-commit and commitlint config files?:
exclude: "^$" fail_fast: false repos:
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.4.0
hooks:
- id: commitlint stages: [commit-msg]
0 verbose cli /root/.cache/pre-commit/repok81ok20m/node_env-default/bin/node /root/.cache/pre-commit/repok81ok20m/node_env-default/bin/npm 1 info using [email protected] 2 info using [email protected] 3 silly config load:file:/root/.cache/pre-commit/repok81ok20m/node_env-default/lib/node_modules/npm/npmrc 4 silly config load:file:/root/.cache/pre-commit/repok81ok20m/.npmrc 5 silly config load:file:/root/.npmrc 6 silly config load:file:/root/.cache/pre-commit/repok81ok20m/node_env-default/etc/npmrc 7 verbose title npm pack 8 verbose argv "pack" 9 verbose logfile logs-max:10 dir:/root/.npm/_logs/2024-10-17T14_20_19_061Z- 10 verbose logfile /root/.npm/_logs/2024-10-17T14_20_19_061Z-debug-0.log 11 silly logfile start cleaning logs, removing 1 files 12 silly logfile done cleaning log files 13 silly packumentCache heap:2197815296 maxSize:549453824 maxEntrySize:274726912 14 warn tarball tarball data for file:/root/.cache/pre-commit/repok81ok20m/ (null) seems to be corrupted. Trying again. 15 warn tarball tarball data for file:/root/.cache/pre-commit/repok81ok20m/ (null) seems to be corrupted. Trying again. 16 verbose stack Error: ENOENT: no such file or directory, lstat '/root/.cache/pre-commit/repok81ok20m/ode_env-default/lib/node_modules/npm/node_modules/sprintf-js/dist/.gitattributes' 17 error code ENOENT 18 error syscall lstat 19 error path /root/.cache/pre-commit/repok81ok20m/ode_env-default/lib/node_modules/npm/node_modules/sprintf-js/dist/.gitattributes 20 error errno -2 21 error enoent ENOENT: no such file or directory, lstat '/root/.cache/pre-commit/repok81ok20m/ode_env-default/lib/node_modules/npm/node_modules/sprintf-js/dist/.gitattributes' 22 error enoent This is related to npm not being able to find a file. 22 error enoent 23 verbose cwd /root/.cache/pre-commit/repok81ok20m 24 verbose os Linux 6.5.0-1025-azure 25 verbose node v23.0.0 26 verbose npm v10.9.0 27 verbose exit -2 28 verbose code -2 29 error A complete log of this run can be found in: /root/.npm/_logs/2024-10-17T14_20_19_061Z-debug-0.log
seeing the same thing with our repos today
Hey we're facing the exact same error too
OK I will check this ASAP, could anyone confirm if this happens with the previous release?
Hi @alessandrojcm . The issue wasnt there for a day or so before the day i reported. This seems to be related to an npm package you are possibly using. Not sure of there was a new npm build that was updated which is something you are using.
Observations:
- The folder node_env-default does not exsist in the vscode build.
- "npm error enoent ENOENT: no such file or directory, lstat '/root/.cache/pre-commit/repowsykjq0q/ode_env-default/lib/node_modules/npm/node_modules/sprintf-js/dist/.gitattributes'" If you see the path in this it is looking for 'ode_env-default' with a missing n. worth looking at what the dependencies are. My repo is private in the org and hence cannot share it. But if needed i can move it to my personal account and then share.
Thanks @ameenrsherali, this hook hasn't really changed at all since the last release (which has some time ago already). Could you please add too the pre commit version that you're using?
I see this with pre-commit 3.8.0 and pre-commit 4.0.0.
Context is a private repo, which currently pins to 3.8.0.
Something related to the new release of node 23.0.0?
If you cd into the cwd reported in your debug logs (eg cwd /root/.cache/pre-commit/repok81ok20m), and switch to the node version reported in the debug logs (23.0.0), then running npm pack gives these errors. If you use another version it packs successfully (I used lts/iron).
- Where does commitlint end up handing off to a new version of node? (may give clues as to what we as users of
pre-commitcan pin to, to get this stage using a more stable version of node. - Does everyone have the typo
ode_env-default(not"node_env-default") in the lstat line of their debugs?
16 verbose stack Error: ENOENT: no such file or directory, lstat '/root/.cache/pre-commit/repok81ok20m/ode_env-default/lib/node_modules/npm/node_modules/sprintf-js/dist/.gitattributes'
It's possible that the root of the issue is pre-commit rather than this hook, as I mentioned this package doesn't really change beyond updating commitlint. I'll look into it when I get a chance.
Node 23 was released 2 days ago (the time this started): 2024-10-16, Version 23.0.0 (Current), @RafaelGSS
As a temporary workaround, could you use the language_version option to pin to Node 22?
I managed to reproduce this, it is definitely due to the node version. Please pin your language_version to node 22.8.0 in the meantime.
Apparently is a bug in Node 23 itself: https://github.com/nodejs/node/issues/55410 https://github.com/ekalinin/nodeenv/issues/371 https://github.com/pre-commit/pre-commit/issues/3339 so we will have to wait for a fix there. In the meantime, use the workaround above.
The language_version workaround works. But what I don't understand is that I didn't have node 23 installed on my system when this is broken.
The documentation of language_version says:
For each language, they default to using the system installed language
I had Node 16 on my system (with nvm) when this is broken, then I installed Node 22.8.0 (as suggested) but it's still broken. It seems to me that pre-commit just uses the latest version of Node disregarding what's on my system.
Isn't this contrary to what the above pre-commit documentation says? commitlint-pre-commit-hook seems just saying the "language is node" in its .pre-commit-hooks.yaml. Shouldn't that just mean use whatever is on the system?
The
language_versionworkaround works. But what I don't understand is that I didn't have node 23 installed on my system when this is broken.The documentation of language_version says:
For each language, they default to using the system installed language
I had Node 16 on my system (with nvm) when this is broken, then I installed Node
22.8.0(as suggested) but it's still broken. It seems to me thatpre-commitjust uses the latest version of Node disregarding what's on my system.Isn't this contrary to what the above
pre-commitdocumentation says?commitlint-pre-commit-hookseems just saying the "language is node" in its.pre-commit-hooks.yaml. Shouldn't that just mean use whatever is on the system?
I've not used pre commit in a while, but as far as I understand it will install its own isolated environment regardless of what is installed on your system.
That is correct it does install its own env and usually downloads the node locally. The temp solution resolves the issue. Closing this issue out. Thanks again.
Thanks @ameenrsherali, I'm going to reopen this to track the upstream bugs. Will close once the workaround is not longer necessary.
Sounds good. Thanks @alessandrojcm
Thanks for tracking members.
Here is our note:
Currently our private repositories' hooks have same issues. Our cases are occurred in these hooks: yamllint, markdownlint-cli2, commitlint.
Someone who have valid '22.9.0' node that is isolated in cache hook, are working well, but... after running 'pre-commit cache clean', has these cases are detected. So we decide to set that hooks disable temporaly until re-active.