【问题标题】:npx create-react-app does not recognize npm as a command and aborts installationnpx create-react-app 无法将 npm 识别为命令并中止安装
【发布时间】:2020-07-14 16:47:07
【问题描述】:

基本上,当我运行 npx create-react-app 时,我会得到这个输出

'npm' is not recognized as an internal or external command,
operable program or batch file.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

'npm' is not recognized as an internal or external command,
operable program or batch file.

Aborting installation.
  npm install --save --save-exact --loglevel error react react-dom react-scripts@0.9.x has failed.

Deleting generated file... package.json
Deleting myapp/ from C:\Users\dralc\Desktop\Projects\React Tutorials
Done.

这个问题似乎只发生在 git bash 而不是 Powershell。

我已经尝试卸载和重新安装节点以及使用 yarn create react-app 并获得相同的输出。我在这里想念什么?任何帮助将不胜感激。

编辑:我使用的npm版本是6.14.6

【问题讨论】:

  • 至于windows中的路径(看过几次后我确信这是问题),转到“编辑系统环境变量”,在“的用户变量”下,选择“路径”并编辑“。为“C:\Users\\AppData\Roaming\npm”添加新行。保存并退出。您需要重新打开您使用的任何控制台(powershell),但是那么它应该可以工作。
  • @ippi 我查看了用户变量,那里已经存在该行。还有什么可能是错的吗?会不会是我使用的控制台有问题?

标签: node.js reactjs npm create-react-app


【解决方案1】:

您的系统中没有安装任何一个节点,或者它可能没有添加到您的路径变量中。 运行命令node -v并验证它是否显示您系统中安装的节点版本。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-10-22
    • 2019-07-25
    • 2020-08-31
    • 2022-06-14
    • 2021-09-11
    • 2020-08-11
    • 2019-05-08
    • 2020-07-26
    相关资源
    最近更新 更多