Open yeheshuah opened 3 months ago
I had a same problem!!!! but I found this solution that is working!
on your wasm-game-of-life directory,
1) npm install -g create-wasm-app
2) then make a package.json file in root dir (I mean the location of your project) and add this:
{
"dependencies": {
"create-wasm-app": "/usr/local/lib/node_modules/create-wasm-app"
}
}
3) npm install
4) npm init wasm-app www 🦀 Rust + 🕸 Wasm = ❤
{ "dependencies": { "create-wasm-app": "/usr/local/lib/node_modules/create-wasm-app" } }
still not working :(
I had a same problem!!!! but I found this solution that is working!
on your wasm-game-of-life directory,
npm install -g create-wasm-app
then make a package.json file in root dir (I mean the location of your project) and add this:
{ "dependencies": { "create-wasm-app": "/usr/local/lib/node_modules/create-wasm-app" } }
npm install
npm init wasm-app www 🦀 Rust + 🕸 Wasm = ❤
haha, thx. We need to replace {/usr/local/lib} with our own path, used npm prefix -g
query
Solution given by @AshkanRamezani doesn't work in node v20.x , but its working fine in v18, Thanks.
@Imran-S-heikh Adding file:
prefix works, my node is v22.
{
"dependencies": {
"create-wasm-app": "file:path/to/node_modules/create-wasm-app"
}
}
there is a new error after i done all recommendations above:
0 verbose cli C:\Program Files\nodejs\node.exe C:\Users\ASUS\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
1 info using npm@10.8.3
2 info using node@v20.10.0
3 silly config load:file:C:\Users\ASUS\AppData\Roaming\npm\node_modules\npm\npmrc
4 silly config load:file:E:\Coding\Code\Wasm\wasm-game-of-life\.npmrc
5 silly config load:file:C:\Users\ASUS\.npmrc
6 silly config load:file:C:\Users\ASUS\AppData\Roaming\npm\etc\npmrc
7 verbose title npm init wasm-app
8 verbose argv "init" "wasm-app"
9 verbose logfile logs-max:10 dir:C:\Users\ASUS\AppData\Local\npm-cache\_logs\2024-09-07T06_27_07_268Z-
10 verbose logfile C:\Users\ASUS\AppData\Local\npm-cache\_logs\2024-09-07T06_27_07_268Z-debug-0.log
11 silly logfile start cleaning logs, removing 2 files
12 silly logfile done cleaning log files
13 silly packumentCache heap:4345298944 maxSize:1086324736 maxEntrySize:543162368
14 verbose shrinkwrap failed to load node_modules/.package-lock.json out of date, updated: C:/Users/ASUS/AppData/Roaming/npm/node_modules/create-wasm-app
15 verbose stack Error: command failed
15 verbose stack at promiseSpawn (C:\Users\ASUS\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\promise-spawn\lib\index.js:22:22)
15 verbose stack at spawnWithShell (C:\Users\ASUS\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\promise-spawn\lib\index.js:124:10)
15 verbose stack at promiseSpawn (C:\Users\ASUS\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\promise-spawn\lib\index.js:12:12)
15 verbose stack at runScriptPkg (C:\Users\ASUS\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\run-script\lib\run-script-pkg.js:77:13)
15 verbose stack at runScript (C:\Users\ASUS\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\run-script\lib\run-script.js:9:12)
15 verbose stack at run (C:\Users\ASUS\AppData\Roaming\npm\node_modules\npm\node_modules\libnpmexec\lib\run-script.js:48:10)
15 verbose stack at async exec (C:\Users\ASUS\AppData\Roaming\npm\node_modules\npm\node_modules\libnpmexec\lib\index.js:298:10)
15 verbose stack at async Init.execCreate (C:\Users\ASUS\AppData\Roaming\npm\node_modules\npm\lib\commands\init.js:135:5)
15 verbose stack at async Init.exec (C:\Users\ASUS\AppData\Roaming\npm\node_modules\npm\lib\commands\init.js:44:14)
15 verbose stack at async Npm.exec (C:\Users\ASUS\AppData\Roaming\npm\node_modules\npm\lib\npm.js:207:9)
16 error code 1
17 error path E:\Coding\Code\Wasm\wasm-game-of-life
18 error command failed
19 error command C:\Windows\system32\cmd.exe /d /s /c create-wasm-app
20 verbose cwd E:\Coding\Code\Wasm\wasm-game-of-life
21 verbose os Windows_NT 10.0.22631
22 verbose node v20.10.0
23 verbose npm v10.8.3
24 verbose exit 1
25 verbose code 1
26 error A complete log of this run can be found in: C:\Users\ASUS\AppData\Local\npm-cache\_logs\2024-09-07T06_27_07_268Z-debug-0.log
you can clone this directly with:
git clone https://github.com/rustwasm/create-wasm-app.git www
I had a same problem!!!! but I found this solution that is working!
on your wasm-game-of-life directory,
npm install -g create-wasm-app
then make a package.json file in root dir (I mean the location of your project) and add this:
{ "dependencies": { "create-wasm-app": "/usr/local/lib/node_modules/create-wasm-app" } }
npm install
npm init wasm-app www 🦀 Rust + 🕸 Wasm = ❤
path of create-wasm-app
can be found directly with npm list -g
It seems like this issue is caused by a bug in the package-json
package, which npm depends on.
You can check the details here: https://github.com/npm/cli/issues/7728
Because of this bug, the bin
field in this repository’s package.json
isn't being read correctly.
You can see the relevant line here: https://github.com/rustwasm/create-wasm-app/blob/9ac3dff9ebea4675e5c478bcdcbc0fd547d1529f/package.json#L7
Although the bug has been fixed, the fix hasn't been merged into npm yet. It will likely be included in the next npm release.
As a temporary fix, I followed the pull request for the package-json
package and manually changed '.'
to './'
in the installed npm. After making that change, running npm init wasm-app www
worked successfully. You can find the relevant line to modify here:
https://github.com/npm/cli/blob/63d6a732c3c0e9c19fd4d147eaa5cc27c29b168d/node_modules/%40npmcli/package-json/lib/normalize.js#L132
Describe the Bug
npm init wasm-app www
fails.Versions
Error
Steps to Reproduce
This tutorial.
Expected Behavior
npm init wasm-app www
creates www folder.Actual Behavior
npm init wasm-app www
fails.