Npm install error npm ERR! Solution

The following are four common npm ERR and solutions

Error one,

npm ERR! A complete log of this run can be found in:

npm ERR!

C:\Users\nanyi\AppData\Roaming\npm-cache_logs\2021-09-17T08_58_23_413Z-debug.l

Check the error log, the error log is in C:\Users... here

If you find err mkdir in the error log

Reason for error: Insufficient permissions

Solution: Close VsCode and start VsCode with administrator privileges (there is also a saying on the Internet that administrator privileges are directly configured in VsCode property compatibility, but my VsCode starts a black screen after configuration)

Error 2, npm ERR! code EINVALIDPACKAGENAME

Cause of error: npm version problem

Solution: npm install --global npm

Error three, npm: The file D:\nodejs\cnpm.ps1 cannot be loaded because running scripts is prohibited on this system.

Solution: delete the file that cannot be loaded in the error message

Error four, npm ERR! Cannot read properties of null (reading 'package')

Solution: switch to cnpm

Guess you like

Origin blog.csdn.net/qq_49491645/article/details/129044386