前言:在使用vscode的过程中,运行npm报错,提示禁止运行脚本

image-20240614161920709

解决方法

打开Windows PowerShell 输入set-executionpolicy remotesigned

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Windows PowerShell
版权所有 (C) Microsoft Corporation。保留所有权利。

尝试新的跨平台 PowerShell https://aka.ms/pscore6

PS C:\Users\Administrator> get-executionpolicy
Restricted
PS C:\Users\Administrator> set-executionpolicy remotesigned

执行策略更改
执行策略可帮助你防止执行不信任的脚本。更改执行策略可能会产生安全风险,如 https:/go.microsoft.com/fwlink/?LinkID=135170
中的 about_Execution_Policies 帮助主题所述。是否要更改执行策略?
[Y] 是(Y) [A] 全是(A) [N] 否(N) [L] 全否(L) [S] 暂停(S) [?] 帮助 (默认值为“N”): y
PS C:\Users\Administrator>