Node 23.0.0 was released 2 days ago and broke hooks in this repository. The log I receive is the following:
An unexpected error has occurred: CalledProcessError: command: ('/home/stas/.cache/pre-commit/repo6fs1kess/node_env-default/bin/node', '/home/stas/.cache/pre-commit/repo6fs1kess/node_env-default/bin/npm', 'pack')
return code: 254
stdout: (none)
stderr:
(node:2233787) 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/stas/.cache/pre-commit/repo6fs1kess/ (null) seems to be corrupted. Trying again.
npm warn tarball tarball data for file:/home/stas/.cache/pre-commit/repo6fs1kess/ (null) seems to be corrupted. Trying again.
npm error code ENOENT
npm error syscall lstat
npm error path /home/stas/.cache/pre-commit/repo6fs1kess/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/stas/.cache/pre-commit/repo6fs1kess/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/stas/.npm/_logs/2024-10-18T16_37_40_681Z-debug-0.log
Check the log at /home/stas/.cache/pre-commit/pre-commit.log
NPM log is no more helpful. This is something related to node v23, and pre-commit defaults to using latest version. The problem is that npm pack works, while node npm pack for some reason does not, and pre-commit invokes the latter.
To reproduce (if this doesn't fail, try pre-commit clean prior to running this):
cd $(mktemp -d)
git init
cat >.pre-commit-config.yaml <<EOF
repos:
- repo: https://github.com/biomejs/pre-commit
rev: "v0.5.0"
hooks:
- id: biome-check
additional_dependencies: ["@biomejs/biome"]
EOF
pre-commit install
pre-commit install-hooks
Works:
cd $(mktemp -d)
git init
cat >.pre-commit-config.yaml <<EOF
repos:
- repo: https://github.com/biomejs/pre-commit
rev: "v0.5.0"
hooks:
- id: biome-check
additional_dependencies: ["@biomejs/biome"]
language_version: '22.0.0'
EOF
pre-commit install
pre-commit install-hooks
language_version can be overridden by end users, but it's expected that hooks work "out of the box", hence pinning language_version here would be very helpful. (to make it clear, this does not depend on system node installation, so won't be exposed to users directly in any way)
Node 23.0.0 was released 2 days ago and broke hooks in this repository. The log I receive is the following:
NPM log is no more helpful. This is something related to node v23, and
pre-commitdefaults to using latest version. The problem is thatnpm packworks, whilenode npm packfor some reason does not, and pre-commit invokes the latter.To reproduce (if this doesn't fail, try
pre-commit cleanprior to running this):Works:
language_versioncan be overridden by end users, but it's expected that hooks work "out of the box", hence pinninglanguage_versionhere would be very helpful. (to make it clear, this does not depend on systemnodeinstallation, so won't be exposed to users directly in any way)