npm React-app中的问题:术语“React-app”不能被识别为小程序、函数、脚本文件或可操作程序的名称

a5g8bdjr  于 5个月前  发布在  React
关注(0)|答案(3)|浏览(58)

我的系统上安装了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的版本有关吗?

uinbv5nw

uinbv5nw1#

您应该使用-g全局安装create-react-app

npm install -g create-react-app

字符串
或者,您可以跳过create-react-app的安装。为此,您需要首先更新到较新版本的nodejs和npm,然后才能运行。

npx create-react-app yourappname

js4nwp54

js4nwp542#

您应该安装第一个节点Download Here.
然后在命令提示符下查看节点版本:node -v & npx -v
最后创建react app npx create-react-app app-name
cd app-name
npm start

qyuhtwio

qyuhtwio3#

我用的是cmd npx create-react-app app-name而不是create-react-app app-name。它工作得很好。但我不知道它是如何解决的。

相关问题