在ubuntu 16.04 LTS中找不到create-react-app命令

Moh*_*ury 1 reactjs create-react-app

我尝试npm install -g create-react-app在终端上使用sudo安装create react app ,然后出现以下消息:

/home/mahi/.npm-global/bin/create-react-app -> /home/mahi/.npm-global/lib/node_modules/create-react-app/index.js + create-react-app@1.4.3 updated 1 package in 11.7s

然后,当我要运行命令create-react-app hello-world时,它表示找不到create-react-app命令.然后我搜索了许多解决方案,我几乎尝试了所有这些解决方案,但没有任何改进,显示一次又一次找不到命令.

小智 6

我有同样的问题,这就是我解决它的方法.它适用于Ubuntu 16.04以及Ubuntu 18.04.

首先,打开终端并运行此命令:

sudo npm install -g -y create-react-app
Run Code Online (Sandbox Code Playgroud)

之后,您将能够在您的计算机上的任何位置使用create-react-app,因为它是全局保存的.