create-react-app 中的问题:术语 'create-react-app' 未被识别为 cmdlet、函数、脚本文件或可运行程序的名称

Issue in create-react-app : The term 'create-react-app' is not recognized as the name of a cmdlet, function, script file, or operable program

我的系统上安装了 Node(v6.10.3) 和 npm(3.10.10)。我在上面安装了create-react-app,成功了。但是,当我尝试通过 运行: create-react-app sample-app 在我的机器上创建一个新项目时,它会出现以下错误:

create-react-app : The term 'create-react-app' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + create-react-app + ~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (create-react-app:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

多年来一直使用 cli,从未遇到过这种情况。有人知道为什么会这样吗?与npm/node的版本有关吗?

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

npm install -g create-react-app

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

npx create-react-app yourappname

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

我使用 cmd npx create-react-app app-name 而不是 create-react-app app-name。 它成功地工作。但是不知道怎么解决的