安装了新命令,但它们仍然无法正常工作

时间:2017-12-09 10:04:16

标签: node.js terminal npm-install create-react-app npm-liveserver

Friends-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 在15.078s更新了1个包 朋友-MacBook-Pro:〜朋友$ live-server -v

-bash:live-server:command not found

Friends-MacBook-Pro:〜朋友$ 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个包

╭─────────────────────────────────────╮    ││    │更新可用5.5.1→5.6.0│    │运行npm i -g npm更新│    ││    ╰─────────────────────────────────────╯

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

在1.566s中添加了1个包

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

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

1 个答案:

答案 0 :(得分:0)

您应该将bin路径添加到用户环境中。

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