Node cannot use the npm command because the environment variables are not configured correctly. The solution is: 1. Open "System Properties"; 2. Find "Environment Variables" -> "System Variables", and then edit the environment Variable; 3. Find the folder where nodejs is located; 4. Click "OK".
The operating environment of this tutorial: Windows 10 system, node v14.16.0 version, DELL G3 computer
What can I do if node cannot use the npm command? manage?
The reason why node is successfully installed but npm cannot be used and the solution
As mentioned, Node is installed successfully, but npm cannot be used.
Cause: The environment variables are not configured correctly.
Solution:
Find the folder where nodejs is located
Let’s elaborate on the reason: I guess it may be because the nvm package management tool reuses the node module, so the node_modules folder in the node version downloaded with nvm is empty, as shown below:
The 12.16.1 version I downloaded manually has content in node_modules, as shown below:
Recommended learning: "node.js video tutorial"
The above is the detailed content of What should I do if node cannot use npm command?. For more information, please follow other related articles on the PHP Chinese website!