简体   繁体   English

使用 npm 安装后无法调用 yarn

[英]can't invoke yarn after installing with npm

I just got a upgraded my laptop and installed yarn via npm我刚刚升级了我的笔记本电脑并通过 npm 安装了 yarn

and for some some reason when I try to invoke yarn --v it throws,出于某种原因,当我尝试调用yarn --v时,它会抛出,

yarn : File C:\Users\mattj\AppData\Roaming\npm\yarn.ps1 cannot be loaded because running scripts is disabled on this
system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ yarn --version
+ ~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

although, when i run yarn.cmd --v虽然,当我运行yarn.cmd --v

it works fine?它工作正常吗?

is this an issue with path?这是路径问题吗?

This might have to do something with powershell 5,这可能与 powershell 5 相关,

 Get-executionPolicy

returns restricted退货限制

I fixed it by running this in powershell:我通过在 powershell 中运行它来修复它:

set-executionpolicy remotesigned

then pressed然后按下

a

and it works并且有效

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM