npx : 无法加载文件 C:\Program Files\nodejs\npx.ps1,因为在此系统上禁止运行脚本
执行
npx create-next-app@latest myNextApp
出现下面的错误
npx : 无法加载文件 C:\Program Files\nodejs\npx.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com /fwlink/?LinkID=135170 中的 about_Execution_Policies。 所在位置 行:1 字符: 1 + npx create-next-app@latest myNextApp + ~~~ + CategoryInfo : SecurityError: (:) [],PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess 出现这个错误

解决方法
一、以管理员身份运行 PowerShell
二、检查当前执行策略
输入命令:get-executionpolicy ,通常会显示 Restricted(禁止任何脚本运行)
三、更改执行策略
输入命令:set-executionpolicy remotesigned ,然后输入Y确认。这允许运行本地脚本,远程脚本需签名
即可


浙公网安备 33010602011771号