首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >安装-g创建-react应用程序提供错误-4048,-4051在Windows上

安装-g创建-react应用程序提供错误-4048,-4051在Windows上
EN

Stack Overflow用户
提问于 2020-05-11 20:53:53
回答 2查看 680关注 0票数 0

我也曾在这方面经历过类似的问题,但他们中的任何一个都没有成功。

我尝试过清除缓存、重新安装、担任管理员等,但在npm安装-g创建反应应用程序或与npm安装的任何依赖项上都出现了相同的错误。

代码语言:javascript
运行
复制
npm -v: 6.14.4
node -v: 12.16.3

错误正在得到:

代码语言:javascript
运行
复制
npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path C:\Users\praba\OneDrive\Desktop\croapp\croapp\node_modules\.staging
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\praba\OneDrive\Desktop\croapp\croapp\node_modules\.staging'
npm ERR!  [Error: EPERM: operation not permitted, unlink 'C:\Users\praba\OneDrive\Desktop\croapp\croapp\node_modules\.staging'] {
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path: 'C:\\Users\\praba\\OneDrive\\Desktop\\croapp\\croapp\\node_modules\\.staging'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\praba\AppData\Roaming\npm-cache\_logs\2020-05-11T20_41_47_242Z-debug.log
`npm install --save @testing-library/react@^9.3.2 @testing-library/jest-dom@^4.2.4 @testing-library/user-event@^7.1.2` failed
C:\Program Files\nodejs\node_modules\npm\node_modules\rimraf\rimraf.js:321
        throw er
        ^

Error: ENOTEMPTY: directory not empty, rmdir 'C:\Users\praba\AppData\Roaming\npm-cache\_npx\7480\node_modules\create-react-app\node_modules'
    at Object.rmdirSync (fs.js:770:3)
    at rmkidsSync (C:\Program Files\nodejs\node_modules\npm\node_modules\rimraf\rimraf.js:364:25)
    at rmdirSync (C:\Program Files\nodejs\node_modules\npm\node_modules\rimraf\rimraf.js:342:7)
    at rimrafSync (C:\Program Files\nodejs\node_modules\npm\node_modules\rimraf\rimraf.js:312:9)
    at C:\Program Files\nodejs\node_modules\npm\node_modules\rimraf\rimraf.js:350:5
    at Array.forEach (<anonymous>)
    at rmkidsSync (C:\Program Files\nodejs\node_modules\npm\node_modules\rimraf\rimraf.js:349:26)
    at rmdirSync (C:\Program Files\nodejs\node_modules\npm\node_modules\rimraf\rimraf.js:342:7)
    at rimrafSync (C:\Program Files\nodejs\node_modules\npm\node_modules\rimraf\rimraf.js:312:9)
    at C:\Program Files\nodejs\node_modules\npm\node_modules\rimraf\rimraf.js:350:5 {
  errno: -4051,
  syscall: 'rmdir',
  code: 'ENOTEMPTY',
  path: 'C:\\Users\\praba\\AppData\\Roaming\\npm-cache\\_npx\\7480\\node_modules\\create-react-app\\node_modules'
}

谢谢!

EN

Stack Overflow用户

发布于 2020-05-11 23:24:04

代码语言:javascript
运行
复制
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

确保当前没有使用node_模块/.暂存文件。

但是一定要使用npx creat-react-app app-name来代替。这是关于这个问题的反应文档。https://reactjs.org/docs/create-a-new-react-app.html#create-react-app

票数 0
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61739105

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档