Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I can't execute npm scripts in node why is this happening and how can i solve it

I need help fixing this problem I hope this can help and I tried running other commands in my terminal but it did not work 15.5.1

My version of node is the latest one.

  • The code says three things

    • Commmand failed at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\node_modules@npmcli\promise-spawn\index.js:64:27)

    • verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run-script" "dev"

    • error command C:\WINDOWS\system32\cmd.exe /d /s /c concurrently "nodemon dist/server.js" tsc -w


0 verbose cli [
0 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
0 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
0 verbose cli   'run-script',
0 verbose cli   'dev'
0 verbose cli ]
1 info using [email protected]
2 info using [email protected]
3 timing config:load:defaults Completed in 1ms
4 timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc Completed in 2ms
5 timing config:load:builtin Completed in 2ms
6 timing config:load:cli Completed in 1ms
7 timing config:load:env Completed in 0ms
8 timing config:load:file:C:\Users\louis\Desktop\web-projects\natours\.npmrc Completed in 1ms
9 timing config:load:project Completed in 2ms
10 timing config:load:file:C:\Users\louis\.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:C:\Users\louis\AppData\Roaming\npm\etc\npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:cafile Completed in 0ms
15 timing config:load:validate Completed in 1ms
16 timing config:load:setUserAgent Completed in 0ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 8ms
19 verbose npm-session 09d944228c5c6035
20 timing npm:load Completed in 18ms
21 timing command:run-script Completed in 464ms
22 verbose stack Error: command failed
22 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\promise-spawn\index.js:64:27)
22 verbose stack     at ChildProcess.emit (node:events:376:20)
22 verbose stack     at maybeClose (node:internal/child_process:1063:16)
22 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:295:5)
23 verbose pkgid [email protected]
24 verbose cwd C:\Users\louis\Desktop\web-projects\natours
25 verbose Windows_NT 10.0.19041
26 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run-script" "dev"
27 verbose node v15.5.1
28 verbose npm  v7.3.0
29 error code 1
30 error path C:\Users\louis\Desktop\web-projects\natours
31 error command failed
32 error command C:\WINDOWS\system32\cmd.exe /d /s /c concurrently "nodemon dist/server.js" tsc -w
33 verbose exit 1



like image 305
Shelton Louis Avatar asked Nov 07 '22 03:11

Shelton Louis


1 Answers

I faced the same issue and just by running the commands with the silent flag on, seems to be solving the problem. In my case I was getting the same error when i was running npm install. Running:
npm install --silent
worked. Form the flag explanation on npmjs docs --silent seems just to be hiding the messages from the terminal, but without the silent flag up, I was not able to see my node_modules installed. Now the application seems to be working fine.

like image 65
Shpend Palushi Avatar answered Nov 11 '22 05:11

Shpend Palushi