如何在 Visual Studio 代码上运行yarn cammand?

Shi*_*yay 7 windows visual-studio-code yarnpkg yarn-workspaces

Yarn 已成功安装在我的笔记本电脑上。但每次我尝试在 VS code 中运行yarn命令时,它都会说:'yarn' is not recognized as an internal or external command, operable program or batch file.

在此输入图像描述

小智 15

如果yarn不工作但npm在你的vs代码终端中运行正常。然后转到窗口搜索并搜索窗口 powercell 并使用以管理员身份运行来运行它,并在数字 2 和 3 中编写代码并将选项设置为 yes

  1. 打开 Powershell 并以管理员身份运行
  2. 获取执行策略
  3. Set-ExecutionPolicy Unrestrict(如果您想要本地用户)-Scope CurrentUser
  4. 重新启动系统


Ham*_*oun 11

我有类似的错误。我刚刚安装了npm并且yarn. 当我使用 VS Code 打开项目并尝试运行yarn install终端时,显示文件“blabla\user\AppData\Roaming\npm\yarn.ps1”未经过数字签名。当我尝试运行时也发生了同样的情况yarn --version,它在 Git Bash 终端中运行良好。为了解决这个问题,我刚刚删除了上面提到的文件yarn.ps1,一切正常。