马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?开始注册
x
PS C:\Users\admin\Desktop\hello-world> cnpm
! b+ b$ d( r- Mcnpm : 无法加载文件 C:\Program Files\nodejs\global\cnpm.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https
+ s" y4 v- t+ I; \8 K4 ~3 K0 |6 {) {:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。" U3 I, |9 H0 b4 k
所在位置 行:1 字符: 11 c9 B$ Q" u6 I* {4 a
+ cnpm
. w. E* |) C4 q6 \% y. W s+ ~~~~
! a0 c) V- A: k- C" }1 s" x/ v + CategoryInfo : SecurityError: (:) [],PSSecurityException& c0 ~& Z/ k& T( f5 [( ]
+ FullyQualifiedErrorId : UnauthorizedAccess
$ w; g! z; l7 s9 @9 EPS C:\Users\admin\Desktop\hello-world> cnpm -v
4 L, ^$ N" t' B! Bcnpm : 无法加载文件 C:\Program Files\nodejs\global\cnpm.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https7 ~# \3 N+ \" r) ?3 b) `! L" F
:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。: k/ Y# g+ ^8 v& j7 k6 Z
所在位置 行:1 字符: 1, N" L. J) f0 W+ ~* k; y- k$ o' A
+ cnpm -v. s$ l, X2 s6 Y( n) A8 \4 d
+ ~~~~. s1 f- {3 m6 }$ \
+ CategoryInfo : SecurityError: (:) [],PSSecurityException
- [% C6 w% w: T' ~( ]3 p* c + FullyQualifiedErrorId : UnauthorizedAccess3 y" j: p; b+ `5 Y- Y$ r( ]
: P( }% D ~1 P B4 y0 A1 x. D
. d/ D* l6 w" a/ J9 O
解决过程:8 Z& j$ `" n7 z5 ]
检查用户是否有足够的权限访问该文件如果文件存在,但您仍然遇到访问问题,可能是因为权限不足。请尝试以管理员身份运行PowerShell。您可以在开始菜单中搜索“PowerShell”,然后右键点击“Windows PowerShell”并选择“以管理员身份运行”。 % N( M6 [3 \; e' b
1 s7 y9 V$ s; b) D
PS C:\Users\admin> Get-ExecutionPolicy Restricted PS C:\Users\admin> Set-ExecutionPolicy RemoteSigned -Scope Process
4 X, @8 {2 b5 f, m& \; K
执行策略更改 执行策略可帮助你防止执行不信任的脚本。更改执行策略可能会产生安全风险,如 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\admin>
0 b. d# s: J5 \5 h/ \' L8 W
4 x) a1 a( N7 u2 u$ x
PS C:\Users\admin\Desktop\hello-world> set-ExecutionPolicy RemoteSigned set-ExecutionPolicy : 对注册表项“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell ”的访问被拒绝。 要更改默认(LocalMachine)作用域的执行策略,请使用“以管理员身份运行”选项启动 Windows PowerShell。 要更改当前用户的执行策略,请运行 "Set-ExecutionPolicy -Scope CurrentUser"。 所在位置 行:1 字符: 1 + set-ExecutionPolicy RemoteSigned + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : PermissionDenied: (:) [Set-ExecutionPolicy], UnauthorizedAccessException + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.SetExecutionPolicyC ommand PS C:\Users\admin\Desktop\hello-world> Set-ExecutionPolicy -Scope CurrentUser RemoteSignedSet-ExecutionPolicy -Scope CurrentUser RemoteSigned^C PS C:\Users\admin\Desktop\hello-world> Set-ExecutionPolicy -Scope CurrentUser RemoteSigned PS C:\Users\admin\Desktop\hello-world> cnpm -v cnpm@4.6.0 (C:\Program Files\nodejs\global\node_modules\cnpm\parse_argv.js) npm@3.10.10 (C:\Program Files\nodejs\global\node_modules\cnpm\node_modules\npm\lib\npm.js) node@12.18.2 (C:\Program Files\nodejs\node.exe) npminstall@2.31.0 (C:\Program Files\nodejs\global\node_modules\cnpm\node_modules\npminstall\lib\index.js) prefix=c:\Program Files\nodejs\global win32 x64 10.0.19045 registry=https://r.npm.taobao.org
% F+ y c7 b5 `0 @( a4 FPS C:\Users\admin\Desktop\hello-world>
5 l6 U" ?3 ?! S# ^' v4 M |