wasm-pack: pack error on Windows 10 17746
๐ Bug description
I just try the hello world on my computer. Project structure is

wasm-pack init is success

but wasm-pack pack . is faild

wasm-pack.log
Aug 31 10:21:31.981 INFO Running pack command...
Aug 31 10:21:31.982 INFO Path: Some(".")
Aug 31 10:21:31.982 INFO Packing up the npm package...
Aug 31 10:21:31.982 ERRO ็ณป็ปๆพไธๅฐๆๅฎ็ๆไปถใ (os error 2)
๐ค Expected Behavior
No error occurred
๐ Steps to reproduce
- create new hello world project
- wasm-pack init
- wasm-pack pack .
๐ Your environment
os: windows 10 x64 17746.1000 wasm-pack version: 0.4.2 rustc version: 1.30.0-nightly (02cb8f2a4 2018-08-29)
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 15 (12 by maintainers)
Commits related to this issue
- Fix npm error when spawned in Windows Issue #277 - Affects running login, pack, and publish on Windows. `Command::new("npm")` launched `npm` with quotes, `"npm"`, causing a run-time error on Windows... — committed to danwilhelm/wasm-pack by danwilhelm 5 years ago
- Fix npm error when spawned in Windows Issue #277 - Affects running login, pack, and publish on Windows. `Command::new("npm")` launched `npm` with quotes, `"npm"`, causing a run-time error on Windows... — committed to rustwasm/wasm-pack by danwilhelm 5 years ago
- Fix npm error when spawned in Windows Issue #277 - Affects running login, pack, and publish on Windows. `Command::new("npm")` launched `npm` with quotes, `"npm"`, causing a run-time error on Windows... — committed to rustwasm/wasm-pack by danwilhelm 5 years ago
this might help: https://github.com/rust-lang/rust/issues/42791
@danwilhelm thanks for the fix. Iโll test then(my locale gussing maybe almost not the cause).
@danwilhelm are you on discord or IRC? feel free to reach out to me on either platfrom (iโm ag_dubs)
Unfortunately, this issue affects login, pack, and publish on Windows!
I verified that the cause suggested by @luotaoyeah is indeed occurring.
Commandplaces"npm"in quotes when calling it, which causes it to fail in Windows only.The recommended solution is to call
npmusingcmd /c. I am working on a PR for this and have verified thecmd /csolution works. Unfortunately, it requires some OS-specific code โ but it seems unavoidable.