VS code上跑yarn start报running scripts is disabled on this system错误的解决方法
Posted 微个日光日
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了VS code上跑yarn start报running scripts is disabled on this system错误的解决方法相关的知识,希望对你有一定的参考价值。
今天想在vs code的命令框里运行yarn start,因为不想命令框满天飞。
结果发现报错了
yarn : File C:\\Program Files\\nodejs\\yarn.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Poli
cies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ yarn start
+ ~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine Undefined
这是因为执行策略的问题造成的,只需要将CurrentUser的ExecutionPolicy改成unrestricted就行了
Set-ExecutionPolicy -Scope CurrentUser Unrestricted
再次执行yarn start,不报错了
Respect!
以上是关于VS code上跑yarn start报running scripts is disabled on this system错误的解决方法的主要内容,如果未能解决你的问题,请参考以下文章
VS code上跑yarn start报running scripts is disabled on this system错误的解决方法