`npx --package=vite-plus vp create` fails with exit 127 when npm is the chosen package manager
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 70/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- nodejs, typescript
Hướng nghiên cứu
Lỗi nằm ở cách vp create tạo môi trường cho trình chạy template: prependToPathToEnvs(..., { ...process.env }) trong packages/cli/src/create/discovery.ts truyền npm_config_package vào lệnh lồng npx create-vite@latest. Hãy bắt đầu bằng cách đọc hàm đó, sau đó tái hiện lỗi bằng lệnh trong issue hoặc đoạn execSync. Hoàn thành khi lần chạy được npm chọn thành công và các khóa chỉ dành cho npm exec bị loại khỏi môi trường của tiến trình con, kèm một kiểm thử hồi quy trong discovery.spec.ts.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
When vp create runs under npx --package=vite-plus and npm is the selected package manager, the template runner fails with sh: create-vite@latest: command not found (exit 127).
npx --package=vite-plus sets npm_config_package=vite-plus in the environment of vp. vp create copies all of process.env into the template runner environment (packages/cli/src/create/discovery.ts, prependToPathToEnvs(..., { ...process.env })). The nested npx create-vite@latest … reads the inherited npm_config_package, so npm installs vite-plus and looks for a bin named create-vite@latest in it, which does not exist.
The same command succeeds when:
- the global
vpruns it, with no outernpx; pnpm dlx --package vite-plus vp createruns it;- pnpm, Yarn, or Bun is the selected package manager;
npm_config_packageis removed from the environment beforevpstarts.
Reproduction
No repository is needed. Run from an empty directory.
Steps to reproduce
npx --yes --package vite-plus vp create vite:application --directory app \
--package-manager npm --no-agent --no-editor --no-git --no-hooks --no-interactive --verbose
Output:
● Running: npx create-vite@latest app --no-interactive --no-immediate --no-rolldown
npm notice run 'create-vite@latest' app --no-interactive --no-immediate --no-rolldown
sh: create-vite@latest: command not found
Exit code 127. app is not created.
Minimal npm-only reproduction of the mechanism, without Vite+:
npx --yes --package cowsay node -e 'require("child_process").execSync("npx --yes create-vite@latest --help", { stdio: "inherit" })'
# sh: create-vite@latest: command not found (exit 127)
The same command with npm_config_package deleted from the child environment succeeds.
Suggested fix
Remove the npm exec-only keys inherited from an outer npm exec or npx (npm_config_package, and npm_config_call for npx -c) from envs before vp create spawns the package-manager runner. I am happy to open a pull request with a test in discovery.spec.ts if you want this approach.
System Info
macOS (Darwin 27.0.0)
Node.js 24.21.0
npm 11.19.0 (outer npx); vp installed npm 12.2.0 for the project
vite-plus 1.1.0 (main at c58f28c read for the source reference)
Used Package Manager
npm
Logs
See the output above. The exit code is 127. The outer npm debug log shows only that the parent command failed.
- Ngôn ngữ chính
- Rust
- Star
- 6k
- Fork
- 274
- Merge trung bình
- 1 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 206
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của voidzero-dev/vite-plus
-
pending triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
voidzero-dev/vite-plus#2882 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
voidzero-dev/vite-plus#2097 · 10 bình luận · 2 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Windows: PowerShell installer (1.1.0) does not add vite-plus\bin to user PATH — 'vp' not recognizedĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
voidzero-dev/vite-plus#2984 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
pending triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 40/100
voidzero-dev/vite-plus#2983 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Concurrent first runs of `vp config` in linked worktrees fail with "could not lock config file"Có thể đã có người làm @naokihaba đã nhận 1 ngày trước. Đang mởpending triage
voidzero-dev/vite-plus#2959 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của voidzero-dev/vite-plus
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
EasyTier/EasyTier#2672 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
XmlFragment children, successors and siblings stop at the first child that is not an XML typeĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
repowise-dev/repowise#3374 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
awaiting-response bug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
wildcard/caro#1562 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày