Repository navigation
Cannot read properties of undefined (reading 'stdin') #4138
Copy link
Copy link
Closed
Labels
Description
Details
I was trying to test Vuejs 3 by creating a new Vuejs 3 project, then try to run it by using "npm run serve". This is what I got:
$ npm run build
> vue-test-003@0.1.0 build
> vue-cli-service build
npm ERR! Cannot read properties of undefined (reading 'stdin')
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\devcomp\AppData\Local\npm-cache\_logs\2023-03-31T05_12_09_205Z-debug-0.log
And here's the content of .log file:
0 verbose cli C:\Program Files\nodejs\node.exe C:\Users\devcomp\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
1 info using npm@9.6.2
2 info using node@v18.15.0
3 timing npm:load:whichnode Completed in 3ms
4 timing config:load:defaults Completed in 3ms
5 timing config:load:file:C:\Users\devcomp\AppData\Roaming\npm\node_modules\npm\npmrc Completed in 3ms
6 timing config:load:builtin Completed in 4ms
7 timing config:load:cli Completed in 3ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:D:\testdir\vue-test-003\.npmrc Completed in 0ms
10 timing config:load:project Completed in 2ms
11 timing config:load:file:C:\Users\devcomp\.npmrc Completed in 1ms
12 timing config:load:user Completed in 1ms
13 timing config:load:file:C:\Users\devcomp\AppData\Roaming\npm\etc\npmrc Completed in 2ms
14 timing config:load:global Completed in 2ms
15 timing config:load:setEnvs Completed in 2ms
16 timing config:load Completed in 19ms
17 timing npm:load:configload Completed in 19ms
18 timing npm:load:mkdirpcache Completed in 1ms
19 timing npm:load:mkdirplogs Completed in 0ms
20 verbose title npm run build
21 verbose argv "run" "build"
22 timing npm:load:setTitle Completed in 2ms
23 timing config:load:flatten Completed in 6ms
24 timing npm:load:display Completed in 8ms
25 verbose logfile logs-max:10 dir:C:\Users\devcomp\AppData\Local\npm-cache\_logs\2023-03-31T05_12_09_205Z-
26 verbose logfile C:\Users\devcomp\AppData\Local\npm-cache\_logs\2023-03-31T05_12_09_205Z-debug-0.log
27 timing npm:load:logFile Completed in 13ms
28 timing npm:load:timers Completed in 0ms
29 timing npm:load:configScope Completed in 0ms
30 timing npm:load Completed in 47ms
31 silly logfile start cleaning logs, removing 10 files
32 timing command:run Completed in 19ms
33 verbose stack TypeError: Cannot read properties of undefined (reading 'stdin')
33 verbose stack at promiseSpawn (C:\Users\devcomp\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\promise-spawn\lib\index.js:60:18)
33 verbose stack at spawnWithShell (C:\Users\devcomp\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\promise-spawn\lib\index.js:123:10)
33 verbose stack at promiseSpawn (C:\Users\devcomp\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\promise-spawn\lib\index.js:12:12)
33 verbose stack at runScriptPkg (C:\Users\devcomp\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\run-script\lib\run-script-pkg.js:79:13)
33 verbose stack at runScript (C:\Users\devcomp\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\run-script\lib\run-script.js:9:16)
33 verbose stack at RunScript.run (C:\Users\devcomp\AppData\Roaming\npm\node_modules\npm\lib\commands\run-script.js:129:13)
33 verbose stack at async module.exports (C:\Users\devcomp\AppData\Roaming\npm\node_modules\npm\lib\cli.js:134:5)
34 verbose cwd D:\testdir\vue-test-003
35 verbose Windows_NT 10.0.19045
36 verbose node v18.15.0
37 verbose npm v9.6.2
38 error Cannot read properties of undefined (reading 'stdin')
39 verbose exit 1
40 timing npm Completed in 105ms
41 verbose code 1
42 error A complete log of this run can be found in:
42 error C:\Users\devcomp\AppData\Local\npm-cache\_logs\2023-03-31T05_12_09_205Z-debug-0.log
(https://github.com/nodejs/help/files/11118438/2023-03-31T05_12_09_205Z-debug-0.log)
So far, I've tried reinstalling nodejs and using the latest version (Node.js 19.8.1) and have had no luck. I also tried to remove all npm and npm-cache in AppData/Local and AppData/Roaming, reinstall it, and tried to run "npm run serve" again and still return exact same error as above.
Node.js version
Node.js version v18.15.0
Example code
No response
Operating system
Currently using Windows 10
Scope
Issue occured when I tried to run "npm run serve" on Vuejs project.
Module and version
Not applicable.
Reactions are currently unavailable
Activity
preveen-stack commentedon Apr 21, 2023
please share relevant lines of code
sk8gear commentedon May 3, 2023
I'd love to share the code that caused the problem. But, the error occurred every time I tried to run "npm run build". I tried to create a new Nextjs project too, and it also gave me the same error. I wonder if there's any setting that I need to check and modify to make "npm run" command work.
chathura226 commentedon Jun 11, 2023
did you find any solution?
protogenyx commentedon Dec 22, 2023
In my case, it was due to the console type, specifically
git bash. Changing it topowershellsolved this issue for me.sk8gear commentedon Jan 22, 2024
I tried this and now I can use npm again in my system. I'm wondering why I can't use npm in git bash? Anyway, thank you for your help.
avivkeller commentedon Jul 1, 2024
Is this issue still occuring? If not, feel free to self-close.
sk8gear commentedon Aug 12, 2024
For now, I can't say that the issue has been solved if I used git bash. But, changing to powershell helped.
Panossa commentedon Jan 22, 2026
Hi, sorry for necro posting, but I have the same error just now, apparently.
I'm on Win 11 Pro with GIT
v2.52.0.windows.1and Nodev20.11.0(because of an older Angular version).Here's my setup, minimized:
echo.js is just a .js file with
console.log("test");inside.echo.sh is just a bash script with a
node echo.jscall inside.package.json has scripts like these:
{ "echo": "echo test", "necho": "node echo.js" }The following are what I tried to do and their results:
npm run echonpm run nechowinpty npm.cmd run echo. echo.shnpm run echonpm run nechowinpty npm.cmd run echo. echo.shThe stdin error changes between versions, too:
Edit:
Node version 24.13.0 and the newest (v25) works! Isn't usable for me because of Angular but at least there's that!