没有不值得去解决的问题,也没有不值得去学习的技术!

npm: Cannot Load File C:\Program Files\nodejs\npm.ps1 Because Script Execution Is Disabled on This System

Enter one of the following commands to change the execution policy, making a permanent change (effective for all sessions)

1. npm : 无法加载文件 C:\Program Files\nodejs\npm.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。

Plaintext
PS C:\wwwroot\phpMyAdmin> npm -v
npm : 无法加载文件 C:\Program Files\nodejs\npm.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 1
+ npm -v
+ ~~~
    + CategoryInfo          : SecurityError: (:) [],PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

2. Confirm that the file C:\Program Files\nodejs\npm.ps1 exists. See Figure 1.

Confirm that the file C:\Program Files\nodejs\npm.ps1 exists
Figure 1

3. Enter one of the following commands to change the execution policy, making a permanent change (effective for all sessions). See Figure 2.

Enter one of the following commands to change the execution policy, making a permanent change (effective for all sessions)
Figure 2
Plaintext

PS C:\wwwroot\phpMyAdmin> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force
PS C:\wwwroot\phpMyAdmin> npm -v
10.9.2
PS C:\wwwroot\phpMyAdmin>

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系