cli icon indicating copy to clipboard operation
cli copied to clipboard

[BUG] Failed index access on utils/tar.js while trying to publish a package with node_modules

Open NormanPerrin opened this issue 1 year ago • 0 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

npm verbose cli /usr/local/bin/node /usr/local/bin/npm
npm info using [email protected]
npm info using [email protected]
npm verbose title npm publish npm-example-v1.tgz
npm verbose argv "publish" "--loglevel" "verbose" "npm-example-v1.tgz"
npm verbose logfile logs-max:10 dir:/Users/normanperrin/.npm/_logs/2024-05-23T06_39_11_271Z-
npm verbose logfile /Users/normanperrin/.npm/_logs/2024-05-23T06_39_11_271Z-debug-0.log
npm verbose publish [ 'npm-example-v1.tgz' ]
npm verbose stack TypeError: Cannot read properties of null (reading '1')
npm verbose stack     at onentry (/usr/local/lib/node_modules/npm/lib/utils/tar.js:63:77)
npm verbose stack     at Parser.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/tar/lib/list.js:57:5)
npm verbose stack     at Parser.emit (node:events:520:28)
npm verbose stack     at [processEntry] (/usr/local/lib/node_modules/npm/node_modules/tar/lib/parse.js:248:12)
npm verbose stack     at [nextEntry] (/usr/local/lib/node_modules/npm/node_modules/tar/lib/parse.js:259:36)
npm verbose stack     at [consumeHeader] (/usr/local/lib/node_modules/npm/node_modules/tar/lib/parse.js:223:32)
npm verbose stack     at [consumeChunkSub] (/usr/local/lib/node_modules/npm/node_modules/tar/lib/parse.js:513:30)
npm verbose stack     at [consumeChunk] (/usr/local/lib/node_modules/npm/node_modules/tar/lib/parse.js:485:30)
npm verbose stack     at Unzip.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/tar/lib/parse.js:410:59)
npm verbose stack     at Unzip.emit (node:events:520:28)
npm error Cannot read properties of null (reading '1')
npm verbose cwd /Users/normanperrin/.local/work/npm-example
npm verbose os Darwin 23.4.0
npm verbose node v22.2.0
npm verbose npm  v10.8.0
npm verbose exit 1
npm verbose code 1

Expected Behavior

For the package to be published

Steps To Reproduce

  1. mkdir package
  2. echo '{ "name": "@npm/example", "version": "0.0.1", "engines": { "node": "20.0.0" } }' > package/package.json
  3. cp -r node_modules package/node_modules
  4. tar -zcvf npm-example-v1.tgz package
  5. npm publish --verbose npm-example-v1.tgz

Environment

  • npm: 10.8.0
  • Node.js: 22.2.0
  • OS Name: macOS
  • System Model Name: Macbook Pro
  • npm config: I have none

NormanPerrin avatar May 23 '24 06:05 NormanPerrin