简体   繁体   English

安装了新命令,但它们仍然不起作用

[英]new commands are installed but they still don't work

Friends-MacBook-Pro:~ friend$ npm install -g live-server 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 /Users/friend/.npm-global/bin/live-server-> /Users/friend/.npm-global/lib/node_modules/live-server/live-server.js

  • live-server@1.2.0 updated 1 package in 15.078s Friends-MacBook-Pro:~ friend$ live-server -v live-server@1.2.0更新了15.078s中的1个程序包Friends-MacBook-Pro:〜friend $ live-server -v

-bash: live-server: command not found -bash:实时服务器:找不到命令

Friends-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 added 106 packages in 13.884s 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个软件包

╭─────────────────────────────────────╮ │ │ │ Update available 5.5.1 → 5.6.0 │ │ Run npm i -g npm to update │ │ │ ╰─────────────────────────────────────╯ ╮││││更新可用5.5.1→5.6。 0││运行npm i -g npm以更新│││╰─────────────────────── ──╯

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

added 1 package in 1.566s 在1.566秒内添加了1个程序包

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

-bash: create-react-app: command not found -bash:create-react-app:找不到命令

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM