在E:\Dokuman Visual Code\areact.js\project app.中创建一个新的React应用程序
正在安装程序包。这可能需要几分钟时间。正在使用cra模板安装react、react-dom和react脚本。。。
npm ERR! code EBADF
npm ERR! EBADF: bad file descriptor, write
npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersFIKCROSAppDataLocalnpm-cache_logs2022-04-05T01_02_39_053Z-debug-0.log
Aborting installation.
npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... package.json
Deleting project-app/ from E:Dokuman Visual Codereact.js
Done.
我遇到了确切的问题。对我有用的是:我已经将VSCode的终端从Powershell更改为bash(重新启动终端应该会有所帮助(。
运行以下命令:
- 运行npm缓存清理--强制
- 然后运行npx create react app(项目名称(
希望这能帮助你
为了克服这个问题,我迁移到node的版本14(创建react应用程序的最低版本(,然后重试
1-安装NVM
https://github.com/nvm-sh/nvm
2-安装节点v14
nvm install 14
3-切换到节点v14
nvm use 14
4-再次重试
npx create-react-app project-name
- 运行
npm cache clean --force
- 禁用您使用的任何第三方防病毒软件,然后重试
您应该尝试使用不同的网络,可以是不同的Wi-Fi网络,也可以是使用移动热点。然后,再次尝试创建react应用程序:
$ npx create-react-app <project_name>
执行以下命令:
npm install -g create-react-app-offline
crao -n <app-name>