'sh' 未被识别为内部或外部命令

'sh' is not recognized as an internal or external command

Creating a new React app in E:\rn-starter\my-app.

Installing packages. This might take a couple of minutes. Installing react, react-dom, and react-scripts with cra-template...

'sh' 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 cra-template has failed.

Deleting generated file... package.json Deleting my-app/ from E:\rn-starter Done.

每当我尝试创建新的 React 项目或 React Native 项目时,都会弹出此错误。尝试重新安装节点和

我使用 windows 命令提示符来执行此操作。使用 git bash 为我解决了这个问题。 我认为问题出在 sh - shell 文件在 windows 中默认不被识别。 然而,使用 git bash,因为它默认识别 shell 脚本,所以它工作得很好。

您可以尝试使用您正在使用的 IDE 的终端而不是 windows 客户端...