问题
今天启动新项目,使用npm run serve时,vscode报错,如下:
> Executing task: npm run serve <
npm : 无法加载文件 C:\Program Files\nodejs\npm.ps1,因为在此系统上禁止运行脚本。有关详细信息,
请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 1
+ npm run serve
+ ~~~
+ CategoryInfo : SecurityError: (:) [],PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
终端进程“C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command npm run serve”
已终止,退出代码: 1。
终端将被任务重用,按任意键关闭。
解决
-
打开设置,输入框搜索shell
-
找到 “terminal.integrated.defaultProfile.windows”,把他改成”Command Prompt”,
-
到这重新跑项目就可以了
版权声明:本文为aiyang1214878408原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。