Solutions to common problems with npm install installation failure

Install cnpm

npm install -g cnpm --registry=http://registry.npm.taobao.org

After installation, you can use cnpm -v to check whether the installation is successful.

Show current mirror URL

npm get registry

cnpm install installation dependencies

cnpm install

While running cnpm install, you may encounter the cnpm: Unable to load file C:\Users\57883\AppData\Roaming\npm\cnpm.ps1 error because running scripts is prohibited on this system.

Solution :

  • Enter Windos PowerShell in the system search box
  • Click "Run as administrator"
  • Enter "set-ExecutionPolicy RemoteSigned" and press Enter
  • Follow the prompts, enter A and press Enter
  • Return to cnpm -v again and execute successfully.

ps: Not only the cnpm command, but also pnpm, yarn and other commands. If such an error is reported when executing, this method can be used to solve it. The premise is that if you use the npm command to install these CLI command tools, they must be installed in the global environment to take effect.

How to solve the error reported by npm install node-sass?

The node and node-sass versions are incompatible, causing the installation of dependencies to fail.

Insert image description here
Solution :

## 查看node版本
node-v
## –save-dev自动将node-sass加入到项目文件夹下的package.json中。
cnpm install --save-dev node-sass

Guess you like

Origin blog.csdn.net/qq_39813400/article/details/127731015