错误信息
yarn : File C:UsersAdminAppDataRoamingnpmyarn.ps1 cannot be loaded
because running scripts is disabled on this system. For more
information, see about_Execution_Policies at
http://go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ yarn
+ ~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
对于那些不知道如何使用Windows PowerShell解决此错误的人
- 打开PowerShell(以管理员身份运行)
- 使用该命令检查当前执行策略
Get-ExecutionPolicy
# You should get 'Restricted'
- 运行此命令使其为"无限制"
Set-ExecutionPolicy Unrestricted
再次检查该命令是否改变了执行策略
Get-ExecutionPolicy You should get 'Unrestricted'
现在尝试在你的项目上运行nodemon
nodemon 'filename.js'
希望对大家有帮助