After configuring the environment variables, the following error still occurs
At this point, you only need to perform the following operations again as an administrator :
npm config set cache "D:\nodejs\node_cache"
npm config set prefix "D:\nodejs\node_global"
npm install express -g
"D:\nodejs\node_cache" is the location of the folder named node_cache in your computer
How to run cmd as administrator:
1. We need to find the cmd command first, and double-click on the computer desktop to open [Computer]. Then click to open [Local Disk C] in the computer, which is our system disk. Then find the folder [Windows] in the local disk C and click to open it. Then open the folder [System 32]. In this way, you can find [cmd] in the [System 32] folder, right-click and run as an administrator.
2. Windows key + s key to search for cmd, click on the right to run as administrator
Reference article:
How to run cmd as administrator
Running the npm install -g nodemon command in vscode reports an error
Right-click vscode, click Properties, click Compatibility in the upper column, and then check the option to run this program as an administrator
After making changes, run npm install -g nodemon again
Getting nodemon: Could not load file D:\nodejs\node_global\nodemon.ps1 because running scripts is prohibited on this system
. For more information, see abo
ut_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170. such mistakes
Press window+s
1. Search for powerShell in the search box, and click to run the program as an administrator
2. Enter set-ExecutionPolicy RemoteSigned
3. Select Y and press Enter