npm ERR! Cannot read properties of undefined (reading ‘stdin’)
Table of Contents
Just sharing a possible solution for this error. I received this after installing a new version of Node.js and spent hours trying to figure how to run my React and Angular projects. The solution below may not be ideal, but it will get you your applications to run until you figure out the most current version of NPM to install.
Snapshot of the error
C:\Projects\react-demo-app>npm start > firstname.lastname@example.org start > react-scripts start 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\Username\AppData\Local\npm-cache\_logs\2022-02-194T16_18_33_034Z-debug-0.log
If you already tried the following:
npm cache clear --force
And deleted the node_modules folder and package.lock.json and ran the following:
And it still doesn’t work, consider the solution below.
Another option is to downgrade NPM to the last known working version used to build your applications.
Example to downgrade from 8.3.1 to 6.14.6.
npm install -g email@example.com
If you get the following error:
Delete the npm folder/files from “C:\Users\YOURUSERNAME\AppData\Roaming\npm”
Then try to install npm@version again.
If you still get an error when trying to install a new library, then remove the package-lock.json file and try again.
Check the version
You should see 6.14.6 or the version you chose to downgrade to.
Hope this helps 🙂