wasm-pack: Npm package for version 0.10.0 does not work at all on Windows
🐛 Bug description
Version 0.10.0 of the npm package is completely broken on Windows.
Previous versions of wasm-pack worked correctly.
It also works correctly on Linux, this is a Windows-only regression.
This completely breaks the Rollup plugin (on Windows).
🤔 Expected Behavior
It should work correctly.
👟 Steps to reproduce
- Create a simple package which uses the
wasm-packnpm library:
{
"dependencies": {
"wasm-pack": "^0.10.0"
},
"scripts": {
"build": "wasm-pack build"
}
}
- Run
yarn install - Run
yarn build
You will see the following error:
yarn run v1.22.10
warning package.json: No license field
$ wasm-pack build
You must install wasm-pack before you can run it
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The important line is this:
You must install wasm-pack before you can run it
It seems that version 0.10.0 is not installing wasm-pack automatically (like how it should). Perhaps this is a regression in binary-install?
🌍 Your environment
Include the relevant details of your environment. wasm-pack version: 0.10.0 rustc version: 1.55.0-nightly (32c9b7b09 2021-07-21)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 9
- Comments: 17 (7 by maintainers)
I just published https://www.npmjs.com/package/wasm-pack/v/0.10.1 that hopefully will work fine on Windows. Please let me know if it does or doesn’t. 🙏
Thanks for offering! But I managed to get a VM running with Windows 10 on my Linux machine. I did a quick investigation and I could reproduce it. One thing I noticed is that if you run
npm install wasm-packand then looks innode_modules\binary-installyou will find a folder calledbinwith awasm-pack.exefile in it. If you run itnode_modules\binary-install\bin\wasm-pack.exe new my_templateand thennode_modules\binary-install\bin\wasm-pack.exe build my_templateboth of those works fine! Not sure whywasm-pack.exeis still left inbinfolder inbinary-install. If we look innode_modules/.binthere’s no.exefile there, just one without file extension and awasm-pack.cmdand awasm-pack.ps1However, by removing this check https://github.com/EverlastingBugstopper/binary-install/blob/main/packages/binary-install/index.js#L76-L78 in my
node_modulesit seems to be working…Meaning the bug seems the be that check only ☝️i.e. buggy
binary-install. It does not take file extensions into consideration.this.binaryPathis simplynode_modules\binary-install\bin\wasm-packand notnode_modules\binary-install\bin\wasm-pack.exeandwasm-packdoes not exists in that folder.wasm-pack.exedoes.This problem has resurfaced in 0.10.3 but downgrading to 0.10.1 works. Windows 11 10.0.22000 Build 22000
@drager Works for me, thanks!
Looking good, for me at least!
Yes, it downloads the package from the releases page. This is the code which does that.
It does not download the
wasm-pack-init.exe, it downloads the.tar.gz(which contains the actual wasm-pack binary).It correctly installs the
node_modules/.bin/wasm-packandnode_modules/.bin/wasm-pack.cmdfiles.It also correctly installs the
node_modules/wasm-pack/run.jsandnode_modules/wasm-pack/binary.jsfiles.All of that works identically to version 0.9.1, so it seems the problem is something in binary-install.
The error is caused by this code in binary-install. That code didn’t exist in version 0.9.1.
I don’t know why that is failing, but that’s as far as my investigation went.