Home >Web Front-end >Front-end Q&A >What should I do if npm cannot be used after node is installed?

What should I do if npm cannot be used after node is installed?

藏色散人
藏色散人Original
2022-12-29 14:23:254425browse

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.

What should I do if npm cannot be used after node is installed?

#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.

What should I do if npm cannot be used after node is installed?

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

What should I do if npm cannot be used after node is installed?

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn