nodists / nodist

Natural node.js and npm version manager for windows.
MIT License
1.6k stars 213 forks source link

error Cannot read properties of undefined (reading 'stdin') #271

Open thierrylach opened 9 months ago

thierrylach commented 9 months ago

After upgrading to nodist 0.10.3 and switching to node 18.19.0 with the following commands, I am unable to execute "npm start".

nodist use 18.19.0
nodist npm match

I get the error

PS C:\src\Angular\REDACTED> npm start

> REDACTED@0.0.0 start
> ng serve --host REDACTED.com --port 4200 --disable-host-check

npm ERR! Cannot read properties of undefined (reading 'stdin')

npm ERR! A complete log of this run can be found in: C:\Users\REDACTED\AppData\Local\npm-cache\_logs\2023-12-18T20_45_49_353Z-debug-0.log
PS C:\src\Angular\REDACTED>

Here is the log:

0 verbose cli C:\Program Files (x86)\Nodist\v-x64\18.19.0\node.exe C:\Program Files (x86)\Nodist\npmv\10.2.3\bin\npm-cli.js
1 info using npm@10.2.3
2 info using node@v18.19.0
3 timing npm:load:whichnode Completed in 69ms
4 timing config:load:defaults Completed in 4ms
5 timing config:load:file:C:\Program Files (x86)\Nodist\npmv\10.2.3\npmrc Completed in 9ms
6 timing config:load:builtin Completed in 9ms
7 timing config:load:cli Completed in 3ms
8 timing config:load:env Completed in 2ms
9 timing config:load:file:C:\src\Angular\REDACTED\.npmrc Completed in 0ms
10 timing config:load:project Completed in 2ms
11 timing config:load:file:C:\Users\REDACTED\.npmrc Completed in 15ms
12 timing config:load:user Completed in 15ms
13 timing config:load:file:C:\Program Files (x86)\Nodist\bin\etc\npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:setEnvs Completed in 2ms
16 timing config:load Completed in 38ms
17 timing npm:load:configload Completed in 39ms
18 timing config:load:flatten Completed in 6ms
19 timing npm:load:mkdirpcache Completed in 25ms
20 timing npm:load:mkdirplogs Completed in 28ms
21 verbose title npm start
22 verbose argv "start"
23 timing npm:load:setTitle Completed in 17ms
24 timing npm:load:display Completed in 1ms
25 verbose logfile logs-max:10 dir:C:\Users\REDACTED\AppData\Local\npm-cache\_logs\2023-12-18T20_39_56_015Z-
26 verbose logfile C:\Users\REDACTED\AppData\Local\npm-cache\_logs\2023-12-18T20_39_56_015Z-debug-0.log
27 timing npm:load:logFile Completed in 19ms
28 timing npm:load:timers Completed in 0ms
29 timing npm:load:configScope Completed in 0ms
30 timing npm:load Completed in 521ms
31 silly logfile start cleaning logs, removing 1 files
32 timing command:run-script Completed in 101ms
33 timing command:start Completed in 121ms
34 verbose stack TypeError: Cannot read properties of undefined (reading 'stdin')
34 verbose stack     at promiseSpawn (C:\Program Files (x86)\Nodist\npmv\10.2.3\node_modules\@npmcli\promise-spawn\lib\index.js:60:18)
34 verbose stack     at spawnWithShell (C:\Program Files (x86)\Nodist\npmv\10.2.3\node_modules\@npmcli\promise-spawn\lib\index.js:123:10)
34 verbose stack     at promiseSpawn (C:\Program Files (x86)\Nodist\npmv\10.2.3\node_modules\@npmcli\promise-spawn\lib\index.js:12:12)
34 verbose stack     at runScriptPkg (C:\Program Files (x86)\Nodist\npmv\10.2.3\node_modules\@npmcli\run-script\lib\run-script-pkg.js:79:13)
34 verbose stack     at runScript (C:\Program Files (x86)\Nodist\npmv\10.2.3\node_modules\@npmcli\run-script\lib\run-script.js:9:16)
34 verbose stack     at RunScript.run (C:\Program Files (x86)\Nodist\npmv\10.2.3\lib\commands\run-script.js:121:13)
34 verbose stack     at async module.exports (C:\Program Files (x86)\Nodist\npmv\10.2.3\lib\cli-entry.js:61:5)
35 verbose cwd C:\src\Angular\REDACTED
36 verbose Windows_NT 10.0.14393
37 verbose node v18.19.0
38 verbose npm  v10.2.3
39 error Cannot read properties of undefined (reading 'stdin')
40 verbose exit 1
41 timing npm Completed in 1202ms
42 verbose code 1
43 error A complete log of this run can be found in: C:\Users\REDACTED\AppData\Local\npm-cache\_logs\2023-12-18T20_39_56_015Z-debug-0.log

There is not an .npmrc in either the application or in the user's home directory.

Mairu commented 8 months ago

I tried to reproduce the problem, after a clean installation of Nodist and using the commands you have provided I have no problems.

As sample project I used https://github.com/gothinkster/angular-realworld-example-app.

It is working using PowerShell, normal Cmd and Git Bash (where I used nodist local 18.19.0 to select the node version).

Has this worked with older versions of Nodist for the same project?