3

Windows 10 通过 yarn 全局安装了其他包但是无法执行包的指令报错“command not found”...

 2 years ago
source link: https://hellodk.cn/post/954
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Windows 10 通过 yarn 全局安装了其他包但是无法执行包的指令报错“command not found” 解决办法

打开 Git Bash,检查 node、npm、yarn 安装情况以及版本

$ node -v
v14.18.0
$ npm -v
6.14.15
$ yarn -v
1.22.18

通过 yarn 安装了 picgo

yarn global add picgo

但是执行 picgo -v 时报错:“command not found”

这是因为 yarn 的 bin 目录没有被添加到系统 PATH 中,可以通过 echo $PATH 验证输出中是否含有 yarn/bin 目录(在 Git Bash 中执行)

执行 yarn global bin 获取 yarn 的 bin 目录

得到 C:\Users\dk\AppData\Local\Yarn\bin,编辑系统环境变量,将它添加到 PATH 中重启终端即可。

执行 picgo -v,输出

1.5.0-alpha.0

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK