Home >Web Front-end >Front-end Q&A >What should I do if npm cannot be used after node is installed?
Solution to the problem that npm cannot be used after node is installed: 1. Find and open the ".npmrc" file under the path "C:\Users\Administrator"; 2. Replace the content with "prefix=${ APPDATA}\npm registry = http://registry.cnpmjs.org”; 3. Save and re-check the npm version.
#The operating environment of this tutorial: Windows 10 system, node v10.16.0 version, Dell G3 computer.
What should I do if npm cannot be used after node is installed?
npm is not available after installing node.js
I recently wanted to use Vue for a project, which relied on node.js, so I downloaded and installed node from the official website
Download address: https://nodejs.org/en/download/
There are also many tutorials on the Internet, which I won’t explain in detail here. The problem I encountered is that after the installation is completed,
Check the node version (command: node -v) is v10.16.0;
Check the npm version (command: npm -v) The cursor keeps flashing for a long time without responding.
At first I thought the version was unstable, so I re-downloaded a lower version, but it still didn’t work. I checked online and thought it was the system environment variables that were wrong. I followed the steps to reconfigure it, but still to no avail. Half a day later, I accidentally saw a blog with few visits. The situation was similar to mine (I forgot the address, but if I found it, I would have gotten it).
There is a file .npmrc.
under the path C:\Users\Administrator. Open it and replace the content with
prefix=${APPDATA}\npm registry = http://registry.cnpmjs.org
and save it. Re-checked the npm version and finally it came out
Note: I am win10. I hope friends who encounter the same problem can solve it as soon as possible.
Recommended learning: "node.js Video Tutorial"
The above is the detailed content of What should I do if npm cannot be used after node is installed?. For more information, please follow other related articles on the PHP Chinese website!