2021-06-30 When opening the terminal in vscode, an error occurred when using the cnpm command

Open the terminal in vscode and get an error when using the cnpm command:

error message prompt

cnpm : Could not load file C:\Users\l\AppData\Roaming\npm\cnpm.ps1 because running scripts is prohibited on this system
. For more information, see
about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
Location Line: 1 Character: 1

  • cnpm i jquery --save
  •   + CategoryInfo          : SecurityError: (:) [],PSSecurityException
      + FullyQualifiedErrorId : UnauthorizedAccess
    
    

insert image description here

Solution

  1. run powershell as administrator
    insert image description here

  2. input the commandset-ExecutionPolicy RemoteSigned

  3. Enter A and press Enterinsert image description here

  4. Enter the cnpm command again to run
    insert image description here

Guess you like

Origin blog.csdn.net/qq_45565693/article/details/118358219