[BUG] Published npm manifest references unshipped workspaces and devDependencies, so npm cannot install/audit inside its own package directory
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 68/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- javascript, nodejs
調査の方向性
リリース tarball 用に package.json を書き換える scripts/publish.js から始め、公開されたマニフェストと files に列挙されているファイルを比較します。インストール済みの npm ディレクトリに対して npm ls、npm install、npm i --package-lock-only を使って問題を再現します。マニフェストが出荷されるコンテンツのみを参照し、そこで npm audit を実行できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
This is not just a request to bump a dependency for a CVE
- This is not solely a request to bump a dependency for a CVE
Current Behavior
Hi there!
The npm tarball ships package.json with workspaces (docs, smoke-tests, mock-globals, mock-registry, workspaces/*), devDependencies on those private workspace packages, and a dependencies lifecycle script that runs scripts/bundle-and-gitignore-deps.js. None of those directories or scripts are in the tarball — files only ships bin/, lib/, index.js, docs/content/, docs/output/, and man/.
So every Arborist command run against the installed npm directory fails:
npm lsreports the workspaces asUNMET DEPENDENCYnpm install --prefix <npm dir> <pkg>fails withE404 @npmcli/docs@^1.0.0npm i --package-lock-onlyfails resolving the devDependencies (EALLOWREMOTEon thetaptarball URL)npm auditfails withENOLOCK, and the lockfile cannot be created because of the above
--omit=dev does not change this, since omitted deps are still resolved per the docs.
Expected Behavior
The published manifest should only reference what the tarball ships. Then npm ls, npm install, and npm audit work inside $(npm root -g)/npm, and a user can inspect or patch the bundled tree with npm itself.
scripts/publish.js already rewrites package.json at release time, so stripping workspaces, devDependencies, and the dev-only scripts entries there would fix it. Happy to send that PR if that direction is acceptable.
To be clear, this is not a request to bump any dependency. The request is that the published manifest only reference what the tarball contains.
Steps To Reproduce
1. Install npm 12.0.2 into a scratch prefix:
npm install -g --prefix /tmp/npm-test [email protected]
NPMDIR=/tmp/npm-test/lib/node_modules/npm
2. List the tree:
/tmp/npm-test/bin/npm ls --depth=0 --prefix "$NPMDIR"
+-- UNMET DEPENDENCY @npmcli/docs@^1.0.0
+-- UNMET DEPENDENCY @npmcli/mock-globals@^1.0.0
+-- UNMET DEPENDENCY @npmcli/mock-registry@^1.0.0
+-- UNMET DEPENDENCY @npmcli/[email protected]
...
3. Install anything into that directory:
/tmp/npm-test/bin/npm install --prefix "$NPMDIR" --no-save [email protected]
npm error code E404
npm error 404 Not Found - GET https://registry.npmjs.org/@npmcli%2fdocs - Not found
npm error 404 The requested resource '@npmcli/docs@^1.0.0' could not be found or you do not have permission to access it.
4. Try to create a lockfile so npm audit can run:
/tmp/npm-test/bin/npm i --package-lock-only --prefix "$NPMDIR"
npm error code EALLOWREMOTE
npm error Fetching packages of type "remote" have been disabled
npm error Refusing to fetch "https://registry.npmjs.org/tap/-/tap-16.3.10.tgz"
5. Stub the four workspace directories with a package.json each and repeat step 3. The install then fails in the dependencies lifecycle script:
npm error command sh -c node scripts/bundle-and-gitignore-deps.js && node scripts/dependency-graph.js
npm error Error: Cannot find module '.../node_modules/npm/scripts/bundle-and-gitignore-deps.js'
Environment
npm -v: 12.0.2
node -v: v26.7.0
OS Name: macOS 26.3
System Model Name: Mac14,13
npm config ls:
; "global" config from ~/.hermes/node/etc/npmrc
prefix = "~/.local"
; "user" config from ~/.npmrc
//registry.npmjs.org/:_authToken = (protected)
; node bin location = ~/.hermes/node/bin/node
; node version = v26.7.0
; npm local prefix = ~
; npm version = 12.0.2
; cwd = ~
; HOME = ~
- 主要言語
- JavaScript
- スター
- 10.3k
- フォーク
- 5k
- 平均マージ
- 4日 11時間
- マージ済み PR(30日)
- 26
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
npm/cli のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 2 日以内に返信
-
[BUG] scripts/dependency-graph.js splits npm-cli-repos.txt on os.EOL, so DEPENDENCIES.md depends on the checkout's line endings対応中かも @saruk-vedant が 7 日前に担当しました。 オープンBug Needs Triage Triage Requested
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 2 日以内に返信
-
[BUG] npm pkg delete removes the first array item for a nonexistent property対応中かも @drawliin が 42 日前に担当しました。 オープンcmd:delete Priority 3
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 2 日以内に返信
-
create node pr: Node.js 20 deprecation & `DEP0040` warnings logged再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンEngineering Priority 1
難易度 1/5 1時間未満 初心者へのやさしさ 80/100
メンテナーはふだん 2 日以内に返信
-
`npm audit signatures` does not report how many packages it skipped for want of registry keys対応中かも @greenlincoln05 が 63 日前に担当しました。 オープンPriority 3
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 2 日以内に返信
似ている issue
-
docs: add SECURITY.md vulnerability reporting policy対応中かも @AK-Lmn が今日担当しました。 オープン
難易度 1/5 1〜3時間 初心者へのやさしさ 72/100
flisk-sh/linux2wasm#12 ·
メンテナーはふだん 1 日以内に返信
-
possible bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
Mintplex-Labs/anything-llm#7388 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 60/100
メンテナーはふだん 1 日以内に返信
-
v6: Minified bootstrap.min.css is missing header info対応中かも @lazerg が今日担当しました。 オープンbug build confirmed has-pr v6
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
githubnext/gh-aw-workshop#6332 ·
メンテナーはふだん 1 日以内に返信