简体   繁体   English

在安装 React 项目和设置 Node Js 时遇到问题

[英]Facing problem during installing react project and setting up of Node Js

I am trying to setup a ReactJS app on Windows using the following command in Git Bash:我正在尝试在 Git Bash 中使用以下命令在 Windows 上设置一个 ReactJS 应用程序:

npx create-react-app my-app

and the output is coming as:和 output 即将到来:

`Creating a new React app in C:\Users\Dell\desktop\react-portfolio-website-1. `在 C:\Users\Dell\desktop\react-portfolio-website-1 中创建一个新的 React 应用程序。

Installing packages.安装包。 This might take a couple of minutes.这可能需要几分钟时间。 Installing react, react-dom, and react-scripts with cra-template...使用 cra-template 安装 react、react-dom 和 react-scripts...

Aborting installation.中止安装。 npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed. npm 安装 --no-audit --save --save-exact --loglevel 错误 react react-dom react-scripts cra-template 失败。

Deleting generated file... package.json Deleting react-portfolio-website-1/ from C:\Users\Dell\desktop node:fs:1226 return handleErrorFromBinding(ctx);删除生成的文件... package.json 从 C 中删除 react-portfolio-website-1/:\Users\Dell\desktop node:fs:1226 return handleErrorFromBinding(ctx); ^ ^

Error: EBUSY: resource busy or locked, rmdir '\?\C:\Users\Dell\desktop\react-portfolio-website-1' at rmdirSync (node:fs:1226:10) at _rmdirSync (node:internal/fs/rimraf:235:5) at rimrafSync (node:internal/fs/rimraf:193:7) at Object.rmSync (node:fs:1275:10) at Object.removeSync (C:\Users\Dell\AppData\Local\npm-cache_npx\c67e74de0542c87c\node_modules\fs-extra\lib\remove\index.js:15:28) at C:\Users\Dell\AppData\Local\npm-cache_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:539:14 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { errno: -4082, syscall: 'rmdir', code: 'EBUSY', path: '\\?\C:\Users\Dell\desktop\react-portfolio-website-1' }错误:EBUSY:资源繁忙或锁定,rmdir '\?\C:\Users\Dell\desktop\react-portfolio-website-1' at rmdirSync (node:fs:1226:10) at _rmdirSync (node:internal/fs /rimraf:235:5) 在 rimrafSync (node:internal/fs/rimraf:193:7) 在 Object.rmSync (node:fs:1275:10) 在 Object.removeSync (C:\Users\Dell\AppData\Local \npm-cache_npx\c67e74de0542c87c\node_modules\fs-extra\lib\remove\index.js:15:28) 在 C:\Users\Dell\AppData\Local\npm-cache_npx\c67e74de0542c87c\node_modules\create-react-app \createReactApp.js:539:14 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { 错误号:-4082,系统调用:'rmdir',代码:'EBUSY',路径:'\\?\ C:\Users\Dell\desktop\react-portfolio-website-1' }

Node.js v18.12.1 ` Node.js v18.12.1`

I always face this problem, expected to get new react js project.我总是面临这个问题,期望获得新的 React js 项目。

I had almost same issue, I had to changed my terminal for VSCode from Powershell to bash, then I ran these commands and it worked.我遇到了几乎相同的问题,我不得不将我的 VSCode 终端从 Powershell 更改为 bash,然后我运行这些命令并且它起作用了。

npm cache clean --force npm 缓存清理 --force

npx create-react-app (project name) npx create-react-app(项目名称)

Hope this should help you希望这对你有帮助

Are you on VPN or do you have any antivirus installed.您使用的是 VPN 还是安装了任何防病毒软件。 Try disabling it and then running npx create---尝试禁用它然后运行 npx create---

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM