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

FOR ANYONE WHO IS GOING THROUGH THE STEPS IN 'Hello, World' AND HAS ERRORS #309

Open
magnus-ISU opened this issue Feb 21, 2024 · 4 comments

Comments

@magnus-ISU
Copy link

Run the following code instead:

cargo generate --git https://github.com/rustwasm/wasm-pack-template # Type wasm-game-of-life

and then

cd wasm-game-of-life
wasm-pack build
npm init wasm-app www
# Fix dependencies. We will first install sd to make replacing text easier and cross-platform and rusty.
cargo install sd
sd '  "devDependencies": \{
    "hello-wasm-pack": "\^0.1.0",
    "webpack": "\^4.29.3",
    "webpack-cli": "\^3.1.0",
    "webpack-dev-server": "\^3.1.5",
    "copy-webpack-plugin": "\^5.0.0"
  \}' ' "dependencies": {
    "wasm-game-of-life": "file:../pkg"
  },
  "devDependencies": {
    "copy-webpack-plugin": "^11.0.0",
    "hello-wasm-pack": "^0.1.0",
    "webpack": "^5.90.0",
    "webpack-cli": "^5.1.4",
    "webpack-dev-server": "^4.15.1"
  }' www/package.json
cd www
rm package-lock.json
npm install
# Fix webpack config
sd -F "new CopyWebpackPlugin(['index.html'])" 'new CopyWebpackPlugin({ patterns: ["index.html"] })' webpack.config.js
sd '^\}' '  experiments: { asyncWebAssembly: true },\n}' webpack.config.js
npm run start

This should work in bash. In zsh you can just run it all at once for some reason

@hunterchen7
Copy link

Thanks for this, was really helpful.

I was still having issues with this but I changed the devDependencies in package.json to this:

  "devDependencies": {
    "copy-webpack-plugin": "^11.0.0",
    "hello-wasm-pack": "^0.1.0",
    "webpack": "^5.88.1",
    "webpack-cli": "^5.1.4",
    "webpack-dev-server": "^4.15.1"
  }

and that fixed it.

@richardpringle
Copy link

@magnus-ISU, did you PR the wasm-pack-template?

@dlyongemallo
Copy link

I got an error at this line:

npm init wasm-app www

The error:

npm error could not determine executable to run
npm error A complete log of this run can be found in: /home/davinci/.npm/_logs/2024-06-02T21_19_23_965Z-debug-0.log

The contents of the log file:

0 verbose cli /home/davinci/.nvm/versions/node/v20.12.2/bin/node /home/davinci/.nvm/versions/node/v20.12.2/bin/npm
1 info using [email protected]
2 info using [email protected]
3 silly config load:file:/home/davinci/.nvm/versions/node/v20.12.2/lib/node_modules/npm/npmrc
4 silly config load:file:/home/davinci/workspace/prep-rust/rustwasm/wasm-game-of-life/.npmrc
5 silly config load:file:/home/davinci/.npmrc
6 silly config load:file:/home/davinci/.nvm/versions/node/v20.12.2/etc/npmrc
7 verbose title npm init wasm-app www
8 verbose argv "init" "wasm-app" "www"
9 verbose logfile logs-max:10 dir:/home/davinci/.npm/_logs/2024-06-02T21_19_23_965Z-
10 verbose logfile /home/davinci/.npm/_logs/2024-06-02T21_19_23_965Z-debug-0.log
11 silly logfile start cleaning logs, removing 1 files
12 silly logfile done cleaning log files
13 silly packumentCache heap:4345298944 maxSize:1086324736 maxEntrySize:543162368
14 http fetch GET 200 https://registry.npmjs.org/create-wasm-app 227ms (cache revalidated)
15 verbose stack Error: could not determine executable to run
15 verbose stack     at getBinFromManifest (/home/davinci/.nvm/versions/node/v20.12.2/lib/node_modules/npm/node_modules/libnpmexec/lib/get-bin-from-manifest.js:17:23)
15 verbose stack     at exec (/home/davinci/.nvm/versions/node/v20.12.2/lib/node_modules/npm/node_modules/libnpmexec/lib/index.js:198:15)
15 verbose stack     at async Init.execCreate (/home/davinci/.nvm/versions/node/v20.12.2/lib/node_modules/npm/lib/commands/init.js:136:5)
15 verbose stack     at async Init.exec (/home/davinci/.nvm/versions/node/v20.12.2/lib/node_modules/npm/lib/commands/init.js:44:14)
15 verbose stack     at async Npm.exec (/home/davinci/.nvm/versions/node/v20.12.2/lib/node_modules/npm/lib/npm.js:207:9)
15 verbose stack     at async module.exports (/home/davinci/.nvm/versions/node/v20.12.2/lib/node_modules/npm/lib/cli/entry.js:74:5)
16 verbose pkgid [email protected]
17 error could not determine executable to run
18 verbose cwd /home/davinci/workspace/prep-rust/rustwasm/wasm-game-of-life
19 verbose os Linux 6.5.0-35-generic
20 verbose node v20.12.2
21 verbose npm  v10.8.1
22 verbose exit 1
23 verbose code 1
24 error A complete log of this run can be found in: /home/davinci/.npm/_logs/2024-06-02T21_19_23_965Z-debug-0.log

@dlyongemallo
Copy link

The work-around (from #169) is apparently to run this instead:

cargo generate --git https://github.com/rustwasm/create-wasm-app  # type "www" at the prompt

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

No branches or pull requests

4 participants