First check whether the environment variables are configured properly:
In the system variable NODE_PATH, the variable value is the installation path of nodejs.
User variable Path contains %NODE_PATH%
If the command line opened through CMD can execute node -v and npm-v, but it's not recognized in VS Code. Then there may be two situations:
1. VS Code is running when configuring environment variables. VS Code does not dynamically refresh environment variables and needs to be restarted to recognize npm commands.
2. Insufficient permissions. You can try running VS Code as administrator.
Recommended related articles and tutorials: vscode tutorial
The above is the detailed content of Unable to use npm command in vscode. For more information, please follow other related articles on the PHP Chinese website!