🐛 BUG: Could not resolve errors when using WASM on Windows
See original GitHub issueWhat version of Wrangler
are you using?
0.0.0-859d6e7
What operating system are you using?
Windows
Describe the Bug
Whilst trying out the new WASI on workers, I was unable to use the new feature on Windows. I believe this is a Windows-specific issue, as it did not occur when using the exact same command with the exact same WASM file on WSL.
Windows NodeJS version: v16.15.0 WSL NodeJS version: v16.16.0
When running
npx wrangler@wasm dev target/wasm32-wasi/release/wasmtest.wasm
on Windows, it prints out the following error:
X [ERROR] Could not resolve "....\npm-cache_npxab8cfd027326cb55\node_modules@cloudflareworkers-wasidistindex.mjs"
../../../AppData/Local/Temp/tmp-31516-jZOY6EVYFut2/index.mjs:2:21:
2 │ import { WASI } from '..\..\npm-cache\_npx\ab8cfd027326cb55\node_modules\@cloudflare\workers-wasi\dist\index.mjs';
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can mark the path
"....\npm-cache_npxab8cfd027326cb55\node_modules@cloudflareworkers-wasidistindex.mjs" as external
to exclude it from the bundle, which will remove this error.
X [ERROR] Could not resolve "........Documentscodewasmtest\targetwasm32-wasi\releasewasmtest.wasm"
../../../AppData/Local/Temp/tmp-31516-jZOY6EVYFut2/index.mjs:3:17:
3 │ import wasm from '..\..\..\..\Documents\code\wasmtest\target\wasm32-wasi\release\wasmtest.wasm';
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can mark the path "........Documentscodewasmtest\targetwasm32-wasi\releasewasmtest.wasm" as
external to exclude it from the bundle, which will remove this error.
X [ERROR] Build failed with 2 errors:
../../../AppData/Local/Temp/tmp-31516-jZOY6EVYFut2/index.mjs:2:21: ERROR: Could not resolve
"....\npm-cache_npxab8cfd027326cb55\node_modules@cloudflareworkers-wasidistindex.mjs"
../../../AppData/Local/Temp/tmp-31516-jZOY6EVYFut2/index.mjs:3:17: ERROR: Could not resolve
"........Documentscodewasmtest\targetwasm32-wasi\releasewasmtest.wasm"
The root of the Rust project I used to test this is in C:\Users\zegevlier\Documents\code\wasmtest
.
I also tried it in the root of the directory containing the .wasm
file, but this also did not work and produced a similar error. This, again, worked perfectly as expected in WSL.
npx wrangler@wasm dev .\wasmtest.wasm
Hope this helps, please let me know if you need additional information.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Wasm build doesn't work on Windows · Issue #687 - GitHub
Running a build on Windows doesn't work when using the esbuild-wasm package. It works fine when using esbuild (but we'd prefer to avoid...
Read more >Weird errors problem with dotnet watch with blazor/wasm.
The watch windows reports an error that dll cannot be found. This happens due to the initial build error. At this point, if...
Read more >Blazor error Type or namespace name 'App' could not be found
The error suggests the project can't find App.razor . Try fully qualifying it in either program.cs for WASM or _hosts.html in Server. –...
Read more >API - esbuild
API. The API can be accessed in one of three ways: on the command line, in JavaScript, and in Go. The concepts and...
Read more >Compiling from Rust to WebAssembly - MDN Web Docs
Not everything is supported yet, but we're working on it. Please file bugs if something is missing. Producing Rust functions that JavaScript can...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Seems to work for me! I’m very pleasantly surprised at how quickly this was resolved, thank you! Now I don’t have to hassle with WSL 😄
Thanks so much for digging in! I’m afk at the moment, will get back to this in a couple of hours