wranglerjs needs to properly forward wasm-pack errors to the user

Created on 27 Jun 2019  路  8Comments  路  Source: cloudflare/wrangler

If you try to build a rust+wasm project, after installing wrangler through npm, you get "OS error 2" instead of "hey, you need to install rust"

status - waiting on response user report wontfix

Most helpful comment

To make this more googleable, here's the full error message:

wrangler build 猬囷笍 Installing wasm-pack... 馃寑 Compiling your project to WebAssembly... Error: No such file or directory (os error 2) Error: ErrorMessage { msg: "failed to execute `\"/Users/xxx/Library/Caches/.wrangler/wasm-pack-3d6efdc8a677d0eb/wasm-pack\" \"build\" \"--target\" \"no-modules\"`: exited with exit code: 1" }

All 8 comments

To make this more googleable, here's the full error message:

wrangler build 猬囷笍 Installing wasm-pack... 馃寑 Compiling your project to WebAssembly... Error: No such file or directory (os error 2) Error: ErrorMessage { msg: "failed to execute `\"/Users/xxx/Library/Caches/.wrangler/wasm-pack-3d6efdc8a677d0eb/wasm-pack\" \"build\" \"--target\" \"no-modules\"`: exited with exit code: 1" }

Title changed to reflect the solution wanted here, to forward the error from wasm-pack (since it already has logic to check your rust install) instead of checking ourselves.

To follow up on this, I looked into wasm-pack and it seems there is already a check for rust version among build steps. When I make it artificially fail, I am getting the following:

rust-check

So this might have been fixed already as a part of a previous change, it would be nice if someone could confirm.

@steveklabnik can you confirm that you are still having this issue?

Unfortunately, I still get a pretty bad error here:

~\tmp> npm i -g @cloudflare/wrangler
C:\Users\Steve Klabnik\AppData\Roaming\npm\wrangler -> C:\Users\Steve Klabnik\AppData\Roaming\npm\node_modules\@cloudflare\wrangler\run-wrangler.js

> @cloudflare/[email protected] postinstall C:\Users\Steve Klabnik\AppData\Roaming\npm\node_modules\@cloudflare\wrangler
> node install-wrangler.js

Downloading release https://workers.cloudflare.com/get-npm-wrangler-binary/1.6.0/x86_64-pc-windows-msvc
Wrangler has been installed!
+ @cloudflare/[email protected]
added 27 packages from 13 contributors in 3.159s
~\tmp> wrangler generate wasm-worker  https://github.com/cloudflare/rustwasm-worker-template.git
猬囷笍 Installing cargo-generate...
 Creating project called `wasm-worker`...
 Done! New project created C:\Users\Steve Klabnik\tmp\wasm-worker
 You will need to update the following fields in the created wrangler.toml file before continuing:
 You can find your account_id and zone_id in the right sidebar of the zone overview tab at https://dash.cloudflare.com
- account_id
~\tmp> cd .\wasm-worker\
~\tmp\wasm-worker [master +13 ~0 -0 !]> wrangler build
猬囷笍 Installing wasm-pack...
 Compiling your project to WebAssembly...
Error: The system cannot find the file specified. (os error 2)
Error: tried running command:
cmd /C C:\\Users\\Steve Klabnik\\AppData\\Local\\.wrangler\\wasm-pack-4aaa7e8f141c59c2\\wasm-pack.exe build --target no-modules
exited with exit code: 1

It's possible this is now a wasm-pack bug?

~\tmp\wasm-worker [master +13 ~0 -0 !]> & 'C:\Users\Steve Klabnik\AppData\Local\.wrangler\wasm-pack-4aaa7e8f141c59c2\wasm-pack.exe' build --target no-modules
Error: The system cannot find the file specified. (os error 2)

This is my first time using wrangler, and I'm seeing the same error trying to build the Hello World Rust template from the Template Gallery. I'm using wrangler 1.8.3 on macOS 10.13.6 (installed using cargo install wrangler with rustc and cargo 1.42.0). The dev, build, and publish sub-commands all fail with "No such file or directory" in wasm-pack build:

$ wrangler publish 猬囷笍 Installing wasm-pack... 馃寑 Compiling your project to WebAssembly... Error: No such file or directory (os error 2) Error: tried running command: ~/Library/Caches/.wrangler/wasm-pack-f824b3b73f38e362/wasm-pack build --target no-modules exited with exit code: 1

Running wasm-pack with -vvvvv does not yield any more output. The dtruss utility seems to show the error coming from posix_spawn(), but I can't tell what command it's trying to run. Maybe it can't find rustc or cargo for some reason?

My next step was going to be starting over with wrangler installed using npm, but that's how @steveklabnik reported this problem originally.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically closed because it has not had recent activity. You may re-open the issue if it is still relevant.

Was this page helpful?
0 / 5 - 0 ratings