我也曾在这方面经历过类似的问题,但他们中的任何一个都没有成功。
我尝试过清除缓存、重新安装、担任管理员等,但在npm安装-g创建反应应用程序或与npm安装的任何依赖项上都出现了相同的错误。
npm -v: 6.14.4
node -v: 12.16.3
错误正在得到:
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'
}
谢谢!
发布于 2020-05-11 23:24:04
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
https://stackoverflow.com/questions/61739105
复制相似问题