zoukankan      html  css  js  c++  java
  • cnpm : 无法加载文件 D: odejs ode_globalcnpm.ps1,因为在此系统上禁止运行脚本。

    cnpm : 无法加载文件 D:nodejsnode_globalcnpm.ps1,因为在此系统上禁止运行脚本

    cnpm : 无法加载文件 D: odejs ode_globalcnpm.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com /fwlink/?LinkID=135170 中的 about_Execution_Policies。 所在位置 行:1 字符: 1 + cnpm install --save-dev electron + ~~~~ + CategoryInfo : SecurityError: (:) [],PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess

    当你遇到这个问题的时候,请不要担心

    我们在控制台执行set-ExecutionPolicy RemoteSigned

    结果报错

    set-ExecutionPolicy : 对注册表项“HKEY_LOCAL_MACHINESOFTWAREMicrosoftPowerShell1ShellIdsMicrosoft.PowerShell”的访问被 拒绝。 要更改默认(LocalMachine)作用域的执行策略,请使用“以管理员身份运行”选项启动 Windows PowerShell。要更改当前用户的执行 策略,请运行 "Set-ExecutionPolicy -Scope CurrentUser"。 所在位置 行:1 字符: 1 + set-ExecutionPolicy RemoteSigned + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : PermissionDenied: (:) [Set-ExecutionPolicy], UnauthorizedAccessException + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand

    提示我们需要通过powershell执行,所以我用vscode会有错误提示

    接下来我们打开powershell重新执行一次set-ExecutionPolicy RemoteSigned

    依旧报错

    set-ExecutionPolicy : 对注册表项“HKEY_LOCAL_MACHINESOFTWAREMicrosoftPowerShell1ShellIdsMicrosoft.PowerShell”的 访问被拒绝。 要更改默认(LocalMachine)作用域的执行策略,请使用“以管理员身份运行”选项启动 Windows PowerShell。要更改当 前用户的执行策略,请运行 "Set-ExecutionPolicy -Scope CurrentUser"。 所在位置 行:1 字符: 1 + set-ExecutionPolicy RemoteSigned + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : PermissionDenied: (:) [Set-ExecutionPolicy], UnauthorizedAccessException + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.SetExecutionPolicyComma nd

    看样子还必须以管理员身份运行

    那么

    在powershell中执行Start-Process powershell -Verb runAs

    会提示授权,并以管理员身份运行powershell

    继续重新执行set-ExecutionPolicy RemoteSigned选择Y

    执行成功

     这样就可以继续使用我们的

    cnpm

  • 相关阅读:
    Java中的多态polymorphism
    Java中的“继承”
    面向对象(Oriented Object Programing)的本质
    Java设计方法原则
    Motor Parameter
    Motor Vocabuary
    JD
    CAN
    多个TXT文件合成一个,输出到excel里
    正则表达式
  • 原文地址:https://www.cnblogs.com/xing-nb/p/14881554.html
Copyright © 2011-2022 走看看