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

npm init wasm-app www fails #213

Open
yeheshuah opened this issue Jul 25, 2024 · 9 comments
Open

npm init wasm-app www fails #213

yeheshuah opened this issue Jul 25, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@yeheshuah
Copy link

Describe the Bug

npm init wasm-app www fails.

Versions

>node --version
v20.16.0
>npm --version
10.8.2

Error

>npm init wasm-app www
npm error could not determine executable to run
npm error A complete log of this run can be found in: C:\Users\User\AppData\Local\npm-cache\_logs\2024-07-25T11_30_21_907Z-debug-0.log
// 2024-07-25T11_30_21_907Z-debug-0.log
0 verbose cli C:\Program Files\nodejs\node.exe C:\Users\User\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
1 info using [email protected]
2 info using [email protected]
3 silly config load:file:C:\Users\User\AppData\Roaming\npm\node_modules\npm\npmrc
4 silly config load:file:C:\Users\User\Documents\_G\Source code\ATBA\wasm_example_2\.npmrc
5 silly config load:file:C:\Users\User\.npmrc
6 silly config load:file:C:\Users\User\AppData\Roaming\npm\etc\npmrc
7 verbose title npm init wasm-app www
8 verbose argv "init" "wasm-app" "www"
9 verbose logfile logs-max:10 dir:C:\Users\User\AppData\Local\npm-cache\_logs\2024-07-25T11_15_43_784Z-
10 verbose logfile C:\Users\User\AppData\Local\npm-cache\_logs\2024-07-25T11_15_43_784Z-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 verbose shrinkwrap failed to load node_modules/.package-lock.json missing from node_modules: ../../../../../../../../usr/local/lib/node_modules/create-wasm-app
15 http fetch GET 200 https://registry.npmjs.org/create-wasm-app 311ms (cache revalidated)
16 verbose stack Error: could not determine executable to run
16 verbose stack     at getBinFromManifest (C:\Users\User\AppData\Roaming\npm\node_modules\npm\node_modules\libnpmexec\lib\get-bin-from-manifest.js:17:23)
16 verbose stack     at exec (C:\Users\User\AppData\Roaming\npm\node_modules\npm\node_modules\libnpmexec\lib\index.js:202:15)
16 verbose stack     at async Init.execCreate (C:\Users\User\AppData\Roaming\npm\node_modules\npm\lib\commands\init.js:136:5)
16 verbose stack     at async Init.exec (C:\Users\User\AppData\Roaming\npm\node_modules\npm\lib\commands\init.js:44:14)
16 verbose stack     at async Npm.exec (C:\Users\User\AppData\Roaming\npm\node_modules\npm\lib\npm.js:207:9)
16 verbose stack     at async module.exports (C:\Users\User\AppData\Roaming\npm\node_modules\npm\lib\cli\entry.js:74:5)
17 verbose pkgid [email protected]
18 error could not determine executable to run
19 verbose cwd C:\Users\User\Documents\_G\Source code\ATBA\wasm_example_2
20 verbose os Windows_NT 10.0.22631
21 verbose node v20.16.0
22 verbose npm  v10.8.2
23 verbose exit 1
24 verbose code 1
25 error A complete log of this run can be found in: C:\Users\User\AppData\Local\npm-cache\_logs\2024-07-25T11_15_43_784Z-debug-0.log

Steps to Reproduce

This tutorial.

Expected Behavior

npm init wasm-app www creates www folder.

Actual Behavior

npm init wasm-app www fails.

@yeheshuah yeheshuah added the bug Something isn't working label Jul 25, 2024
@AshkanRamezani
Copy link

AshkanRamezani commented Jul 26, 2024

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

  1. 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"
  }
}

  1. npm install

  1. npm init wasm-app www
    🦀 Rust + 🕸 Wasm = ❤

@woshishabii
Copy link

{
"dependencies": {
"create-wasm-app": "/usr/local/lib/node_modules/create-wasm-app"
}
}

still not working :(

@wangsj1018
Copy link

wangsj1018 commented Aug 5, 2024

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"
  }
}
  1. npm install

  2. 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

@Imran-S-heikh
Copy link

Solution given by @AshkanRamezani doesn't work in node v20.x , but its working fine in v18, Thanks.

@Fancyflame
Copy link

@Imran-S-heikh Adding file: prefix works, my node is v22.

{
  "dependencies": {
    "create-wasm-app": "file:path/to/node_modules/create-wasm-app"
  }
}

@Jnternet
Copy link

Jnternet commented Sep 7, 2024

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 [email protected]
2 info using [email protected]
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

@AlbericoD
Copy link

you can clone this directly with:

git clone https://github.com/rustwasm/create-wasm-app.git www

@CanglongCl
Copy link

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"
  }
}
  1. npm install

  2. npm init wasm-app www
    🦀 Rust + 🕸 Wasm = ❤

path of create-wasm-app can be found directly with npm list -g

@7crabs
Copy link

7crabs commented Sep 28, 2024

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: npm/cli#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:

"create-wasm-app": ".bin/create-wasm-app.js"

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants