Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasm-pack cannot be launched #56

Closed
fdietze opened this issue Apr 2, 2019 · 4 comments · Fixed by #68
Closed

wasm-pack cannot be launched #56

fdietze opened this issue Apr 2, 2019 · 4 comments · Fixed by #68
Labels
question Further information is requested

Comments

@fdietze
Copy link

fdietze commented Apr 2, 2019

When including the plugin like this:

module.exports.plugins.push(new WasmPackPlugin({
      crateDirectory: Path.resolve(__dirname, "crate"),
    }));

It always fails with:

wasm-pack error: Error: spawn wasm-pack ENOENT

Even though I have wasm-pack in $PATH and can launch it from the command line.
I can even launch it right before adding the plugin like this:

childProcess.spawn("wasm-pack", {stdio: [process.stdin, process.stdout, process.stderr]});

what could be wrong?

@xtuc
Copy link
Member

xtuc commented Apr 3, 2019

The plugin depends on wasm-pack, did you install it? see https://rustwasm.github.io/wasm-pack/installer/.

It's not explicit in our README, would you mind doing a PR?

@xtuc xtuc added the question Further information is requested label Apr 3, 2019
@fdietze
Copy link
Author

fdietze commented Apr 3, 2019

Thanks for the response. As I said, wasm-pack is installed and I can run it. I can even run it from the webpack-config. But the plugin does not find it.

@xtuc
Copy link
Member

xtuc commented Apr 3, 2019

Indeed, sorry.

The plugin also uses spawn https://github.com/wasm-tool/wasm-pack-plugin/blob/master/plugin.js#L117, I'm wondering if we add

  env: process.env

in the options here https://github.com/wasm-tool/wasm-pack-plugin/blob/master/plugin.js#L108 if it would work, could you please try that?

@fdietze
Copy link
Author

fdietze commented Apr 4, 2019

Actually my cwd didn't exist.

The problem was a misleading error message: nodejs/node#11520

So a better error message in this plugin would be helpful here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants