[BUG] npx <pkg>@<exact version> loads Arborist and asks the registry when the npx cache already has it
メンテナーはふだん 2 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- javascript, nodejs
- 領域
- cli, performance
調査の方向性
Start in lib/commands/exec.js and the libnpmexec entry point where getManifest is called with preferOnline, and trace how a manifest is resolved for a spec already in the npx cache. Also read lib/commands/init.js and the update-workspaces call it makes. Reproduce with npx --yes [email protected] --loglevel http on a warm cache and count loaded modules via NODE_OPTIONS; done means a pinned cached spec runs the bin with no packument request and a much lower module count, while ranges and tags keep the current path.
索引モデルが 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
npx [email protected] my-app --template react with create-vite 9.2.1 already in the npx cache still loads 543 modules and revalidates the packument before it runs the bin. Arborist and pacote are required at the top of libnpmexec, and getManifest uses preferOnline. npm create also loads Arborist through update-workspaces in lib/commands/init.js.
Expected Behavior
For a registry spec pinned to an exact version that's already in the npx cache dir, and isn't in the local tree or global prefix, the bin can run straight from the cache. With that and lazy requires it's 142 modules for npx and 150 for npm create, with no network. Ranges, tags and anything not cached take the current path. With a warm cache, across two runs, npx gets 1.8x faster on Windows (about 0.7 s saved) and 2.6-2.8x faster on Linux. npm create is 1.75x faster on both.
Steps To Reproduce
- Run
npx --yes [email protected] my-app --template reactonce so create-vite 9.2.1 is in the npx cache. - Run it again with
--loglevel http, or withNODE_OPTIONSrequiring a script that printsObject.keys(require.cache).lengthon exit. - npm still fetches the create-vite packument and loads 543 modules (565 on 12.2.3) before it runs the cached bin. Same for
npm create [email protected] my-app -- --template react.
Environment
- npm: 11.19.0 for the timings above. 12.2.3 behaves the same (same registry request, 565 modules).
- Node.js: 26.7.0
- OS Name: Windows 11 (x64) and Linux (WSL2, ext4) on the same machine
- System Model Name: desktop, Intel Core i9-10900K
- npm config:
; defaults, with a warm cache
- 主要言語
- 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 日以内に返信