-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
npm pack
crash in Node 23
#55410
Comments
I can't reproduce. Does the file that it's looking for exist? $ node -v
v23.0.0
$ cat package.json
{
"name": "package",
"version": "0.0.0"
}
$ npm pack
(node:112161) 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 notice
npm notice 📦 package@0.0.0
npm notice Tarball Contents
npm notice 49B package.json
npm notice Tarball Details
npm notice name: package
npm notice version: 0.0.0
npm notice filename: package-0.0.0.tgz
npm notice package size: 140 B
npm notice unpacked size: 49 B
npm notice shasum: 9b86ea669576bef9600e739c770b2e5635f75482
npm notice integrity: sha512-sKnSxYIx7NX5u[...]PXtisbzPyqMIA==
npm notice total files: 1
npm notice
package-0.0.0.tgz |
It's looking for |
Why is it looking for that file? Can you provide your |
I've been able to reproduce now: $ node -v
v23.0.0
$ cat package.json
{
"name": "package",
"version": "0.0.0"
}
$ tree
.
├── dist
│ └── index.cjs
└── package.json
$ npm pack
(node:114615) 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:/path/ (null) seems to be corrupted. Trying again.
npm warn tarball tarball data for file:/path/ (null) seems to be corrupted. Trying again.
npm error code ENOENT
npm error syscall lstat
npm error path /path/ist/index.cjs
npm error errno -2
npm error enoent ENOENT: no such file or directory, lstat '/path/ist/index.cjs'
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/user/.npm/_logs/2024-10-16T18_55_56_185Z-debug-0.log |
Looks like a Node.js side issue. I downgraded my npm to v10.8.3 (the version w/ Node.js v22.9.0) and the error still occured. I then downgraded my Node.js to v22.9.0, and kept npm at v10.9.0, and the error no longer occured. CC @nodejs/npm |
I don't know why, but it does not in any other Node.js version. package.json is here: directory structure, @redyetidev
|
Here's the stacktrace READ /.../ist/index.cjs
at Object.lstat (node:fs:1549:15)
at Object.lstat (/node/deps/npm/node_modules/graceful-fs/polyfills.js:309:16)
at [stat] (/node/deps/npm/node_modules/tar/lib/pack.js:181:13)
at [processJob] (/node/deps/npm/node_modules/tar/lib/pack.js:278:19)
at [process] (/node/deps/npm/node_modules/tar/lib/pack.js:232:23)
at [addFSEntry] (/node/deps/npm/node_modules/tar/lib/pack.js:174:18)
at Pack.write (/node/deps/npm/node_modules/tar/lib/pack.js:150:23)
at Pack.add (/node/deps/npm/node_modules/tar/lib/pack.js:129:10)
at addFilesAsync (/node/deps/npm/node_modules/tar/lib/create.js:95:9)
at create (/node/deps/npm/node_modules/tar/lib/create.js:109:3)
at module.exports (/node/deps/npm/node_modules/tar/lib/create.js:39:7)
at /node/deps/npm/node_modules/pacote/lib/dir.js:76:26 Intrestingly, a few calls before this is: READ /.../dist/index.cjs
at Object.lstat (node:fs:1549:15)
at Object.lstat (/node/deps/npm/node_modules/graceful-fs/polyfills.js:309:16)
at PackWalker.stat (/node/deps/npm/node_modules/ignore-walk/lib/index.js:177:8)
at PackWalker.stat (/node/deps/npm/node_modules/npm-packlist/lib/index.js:192:18)
at /node/deps/npm/node_modules/ignore-walk/lib/index.js:153:14
at Array.forEach (<anonymous>)
at PackWalker.filterEntries (/node/deps/npm/node_modules/ignore-walk/lib/index.js:149:16)
at PackWalker.filterEntries (/node/deps/npm/node_modules/npm-packlist/lib/index.js:173:18)
at PackWalker.onReaddir (/node/deps/npm/node_modules/ignore-walk/lib/index.js:78:14)
at /node/deps/npm/node_modules/ignore-walk/lib/index.js:54:42
at /node/deps/npm/node_modules/graceful-fs/graceful-fs.js:228:16
at FSReqCallback.oncomplete (node:fs:188:23) Update The failing call is the call to https://github.com/npm/cli/blob/62c71e5128a01283f97bd62da30ddc673bddda0b/lib/commands/pack.js#L49 More specifically, the call to |
Same/Similar issue here that just started occuring today when trying to install renovatebot's pre-commit hook (https://github.com/renovatebot/pre-commit-hooks) which has been working for me up until today. Worth noting, similar to the |
This is a reminder that "me too" comments only add noise. For everyone considering commenting, please only comment if you have something meaningful to add to the conversation. If you're experiencing this issue, please 👍 the issue or a comment you agree with. There is no need to comment if you are also affected by the this. |
Self-note: We should add |
I've made a minimal reproduction: const walk = require('ignore-walk');
const { resolve, join } = require('path')
const packageDir = resolve('../testing') + '/';
walk({
path: join(packageDir, 'dist'),
parent: {
root: packageDir,
result: new Set([]),
},
}, console.log) |
This seems to be an issue with some logic in |
|
IMHO path separators shouldn't be preserved since that would make the resolution of identical paths (one with |
Version
v23.0.0
Platform
same in CI
Subsystem
No response
What steps will reproduce the bug?
nvm install 23 corepack enable npm pack
How often does it reproduce? Is there a required condition?
it's only happening on Node 23.0.0.
No such issues in Node 18, Node 20 and Node 22.
What is the expected behavior? Why is that the expected behavior?
it should pack
What do you see instead?
ist
is actuallydist
— it's loosing the first letter of the directory nameAdditional information
from
package.json
:from
.log
file:The text was updated successfully, but these errors were encountered: