新的命令被安装,但他们仍然无法正常工作

朋友-MacBook-Pro:〜朋友$ npm install -g live-server

/Users/friend/.npm-global/bin/live-server – > /Users/friend/.npm-global/lib/node_modules/live-server/live-server.js

  • live-server@1.2.0更新1个包在15.078s Friends-MacBook-Pro:〜friend $ live-server -v

-bash:live-server:命令未find

朋友-MacBook-Pro:〜friend $ npm install -g create-react-app /Users/friend/.npm-global/bin/create-react-app – > /Users/friend/.npm-global/lib/node_modules /create-react-app/index.js + create-react-app@1.4.3在13.884s中添加了106个包

╭─────────────────────────────────────────────────────────────────────────────────────────│ 0││运行npm i -g npm更新│││╰─────────────────────────────────── ──╯

朋友-MacBook-Pro:〜朋友$ npm i -g npm + npm@1.0.0

在1.566s添加了1个包

朋友-MacBook-Pro:〜朋友$ create-react-app newtypelabs.io

-bash:create-react-app:command not found

您应该将binpath添加到您的用户环境。

echo 'export PATH="/Users/friend/.npm-global/bin:$PATH"' >> ~/.bash_profile