简体   繁体   中英

While installing npm package into visual studio code problem

I have used the command to install npm package into my visual studio code for that, fire a command into my terminal, npm install -g create-react-app but, I am getting errors. enter image description here

It's basically saying that Powershell's execution policy does not allow running.ps1 scripts. When you run npm install, it tries to execute``

You can solve this in two ways:

  1. Use command prompt instead of Powershell
  2. Set script execution policy in Powershell

Solution 1

I suggest you take a look at this answer for switching from powershell to command prompt: Visual Studio Code, how to switch from powershell.exe to cmd.exe

Solution 2

Open powershell as administrator, then type the following command in there
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

This will set the execution policy and allow executing remotely signed (third party) scripts, which means NPM can be run.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM