“create-react-app”不被识别为内部或外部命令

我正尝试在Windows PC上使用create-react-app命令设置反应应用程序。 我已经在我的Mac电脑上使用它,它运作良好。 但是我遇到了一个问题。 这里我的命令行上的步骤。 我错过了什么?

C:\Windows\system32>cd C:\Users\ugur\Desktop\deneme C:\Users\ugur\Desktop\deneme>npm init This utility will walk you through creating a package.json file. It only covers the most common items, and tries to guess sensible defaults. See 'npm help json' for definitive documentation on these fields and exactly what they do. Use 'npm install <pkg> --save' afterwards to install a package and save it as a dependency in the package.json file. Press ^C at any time to quit. name: (deneme) version: (1.0.0) description: entry point: (index.js) test command: git repository: keywords: license: (ISC) About to write to C:\Users\ugur\Desktop\deneme\package.json: { "name": "deneme", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "Ugur <ugur@abc.com.tr> (http://www.abc.com.tr)", "license": "ISC" } Is this ok? (yes) C:\Users\ugur\Desktop\deneme>npm install -g create-react-app C:\Users\ugur\AppData\Roaming\npm\create-react-app -> C:\Users\ugur\ AppData\Roaming\npm\node_modules\create-react-app\index.js C:\Users\ugur\AppData\Roaming\npm `-- create-react-app@0.2.0 +-- chalk@1.1.3 | +-- ansi-styles@2.2.1 | +-- escape-string-regexp@1.0.5 | +-- has-ansi@2.0.0 | | `-- ansi-regex@2.0.0 | +-- strip-ansi@3.0.1 | `-- supports-color@2.0.0 +-- cross-spawn@4.0.0 | +-- lru-cache@4.0.1 | | +-- pseudomap@1.0.2 | | `-- yallist@2.0.0 | `-- which@1.2.10 | `-- isexe@1.1.2 +-- minimist@1.2.0 `-- semver@5.3.0 C:\Users\ugur\Desktop\deneme>create-react-app new_app 'create-react-app' is not recognized as an internal or external command, operable program or batch file. 

另外npmconfigurationpath就像

C:\ Users \用户UGUR \应用程序数据\漫游\ NPM \ node_modules \创build反应的应用内\

我通过向windows PATHvariables添加C:\Users\ugur\AppData\Roaming\npm来解决这个问题。

我添加这个,因为这在Google上popup,我遇到了麻烦。

我在Windows 10上searchC:\ 'create-react-app',path是C:\Users\Admin\AppData\Roaming\npm\node_modules

我添加到环境variables>path和命令现在工作。

我必须将c:\ node_modules.bin添加到我的path来运行create-react-app

做一个searchcreate-react-app并在你的path中使用它。

这个问题主要是由两个原因造成的:

  1. pathvariables问题
  2. Npm版本问题

将C:\ Users \ ugur \ AppData \ Roaming \ npm添加到Windows PATHvariables并将npm版本升级到5.5.1

我也遇到同样的问题,但我通过以下步骤解决它

  1. 使用命令npm root -g检查您的全局目录
  2. 检查文件夹,它会有你的安装软件包.cmd
  3. 如果是,请复制文件夹的path并放入用户variables的path。

谢谢