我的系统上安装了Node(v6.10.3)和npm(3.10.10)。我在上面安装了create-react-app
,它是成功的。但是,当我试图通过简单地运行:create-react-app sample-app
在我的机器上创建一个新项目时,它给了我以下错误:
下载app:无法将术语“Pull-react-app”识别为小工具、函数、脚本文件或可操作程序的名称。请检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试。在行:1 char:1 + Pull-react-app + ~ + CategoryInfo:ObjectNotFound:(Pull-react-app:String)[],CommandNotFoundException + FullyNotfiedErrorId:CommandNotFoundException
我一直在使用npm多年,从来没有遇到过这种情况。有人知道为什么会发生这种情况吗?这与npm/node的版本有关吗?
3条答案
按热度按时间uinbv5nw1#
您应该使用
-g
全局安装create-react-app
。字符串
或者,您可以跳过
create-react-app
的安装。为此,您需要首先更新到较新版本的nodejs和npm,然后才能运行。型
js4nwp542#
您应该安装第一个节点Download Here.
然后在命令提示符下查看节点版本:
node -v
&npx -v
最后创建react app
npx create-react-app app-name
cd app-name
个npm start
个qyuhtwio3#
我用的是cmd
npx create-react-app app-name
而不是create-react-app app-name
。它工作得很好。但我不知道它是如何解决的。