yarn: command not found

in npm with 0 comment views: 367 times

在bash中使用npm安装 yarn 和 react-native-cli 。安装成功了,但提示如下:

yarn: command not found

react-native: command not found

原因是没有将安装路径加入到Path中

bb:aj bb$ npm install -g yarn
/Users/bb/.npm/bin/yarnpkg -> /Users/bb/.npm/lib/node_modules/yarn/bin/yarn.js
/Users/bb/.npm/bin/yarn -> /Users/bb/.npm/lib/node_modules/yarn/bin/yarn.js
+ yarn@1.17.3
updated 1 package in 1.361s
bb:aj bb$ yarn -v
bash: yarn: command not found
bb:aj bb$ export PATH=/Users/bb/.npm/bin/:$PATH
bb:aj bb$ echo $PATH
/Users/bb/.npm/bin/:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
bb:aj bb$ yarn -v
1.17.3
Responses