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

Error started today for an npm install. #163

Open
ameenrsherali opened this issue Oct 16, 2024 · 26 comments
Open

Error started today for an npm install. #163

ameenrsherali opened this issue Oct 16, 2024 · 26 comments
Assignees
Labels
bug Something isn't working

Comments

@ameenrsherali
Copy link

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

@kishan-mg
Copy link

even we have faced the same error.

@alessandrojcm
Copy link
Owner

Hey, could you please submit a repo where this happens? Thanks

@kishan-mg
Copy link

[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

@alessandrojcm
Copy link
Owner

Sorry but I meant a git repository that I can clone so I can debug the issue.

@kishan-mg
Copy link

We have this repo being invoked from pipeline existing which is present within a private repo.

@alessandrojcm
Copy link
Owner

Ok gotcha, could you please then paste your pre-commit and commitlint config files?:

@kishan-mg
Copy link

exclude: "^$"
fail_fast: false
repos:

@kishan-mg
Copy link

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

@luciidlou
Copy link

seeing the same thing with our repos today

@hassanraza0054
Copy link

Hey we're facing the exact same error too

@alessandrojcm
Copy link
Owner

OK I will check this ASAP, could anyone confirm if this happens with the previous release?

@ameenrsherali
Copy link
Author

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:

  1. The folder node_env-default does not exsist in the vscode build.
  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'" 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.

@alessandrojcm
Copy link
Owner

alessandrojcm commented Oct 18, 2024

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?

@jfeldstein-cw
Copy link

jfeldstein-cw commented Oct 18, 2024

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.

@jfeldstein-cw
Copy link

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).

  1. Where does commitlint end up handing off to a new version of node? (may give clues as to what we as users of pre-commit can pin to, to get this stage using a more stable version of node.
  2. 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'

@alessandrojcm
Copy link
Owner

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.

@jfeldstein-cw
Copy link

Node 23 was released 2 days ago (the time this started): 2024-10-16, Version 23.0.0 (Current), @RafaelGSS

@alessandrojcm
Copy link
Owner

As a temporary workaround, could you use the language_version option to pin to Node 22?

@alessandrojcm alessandrojcm self-assigned this Oct 18, 2024
@alessandrojcm alessandrojcm added the bug Something isn't working label Oct 18, 2024
@alessandrojcm
Copy link
Owner

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.

@alessandrojcm
Copy link
Owner

Apparently is a bug in Node 23 itself: nodejs/node#55410 ekalinin/nodeenv#371 pre-commit/pre-commit#3339 so we will have to wait for a fix there. In the meantime, use the workaround above.

@yulucodebase
Copy link

yulucodebase commented Oct 19, 2024

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?

@alessandrojcm
Copy link
Owner

alessandrojcm commented Oct 19, 2024

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?

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.

@ameenrsherali
Copy link
Author

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.

@alessandrojcm
Copy link
Owner

Thanks @ameenrsherali, I'm going to reopen this to track the upstream bugs. Will close once the workaround is not longer necessary.

@alessandrojcm alessandrojcm reopened this Oct 20, 2024
@ameenrsherali
Copy link
Author

Sounds good. Thanks @alessandrojcm

@SPONGE-JL
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants