报错全文

npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path D:\node.js\node_cache\_cacache\tmp\ea5120a8
npm ERR! errno EPERM
npm ERR! FetchError: Invalid response body while trying to fetch https://registry.npm.taobao.org/@vue%2fcli-plugin-babel: EPERM: operation not permitted, open 'D:\node.js\node_cache\_cacache\tmp\ea5120a8'
npm ERR!     at D:\node.js\node_modules\npm\node_modules\minipass-fetch\lib\body.js:162:15
npm ERR!     at async Arborist.[nodeFromEdge] (D:\node.js\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1061:19)
npm ERR!     at async Arborist.[buildDepStep] (D:\node.js\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:930:11)
npm ERR!     at async Arborist.buildIdealTree (D:\node.js\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:216:7)
npm ERR!     at async Promise.all (index 1)
npm ERR!     at async Arborist.reify (D:\node.js\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:149:5)
npm ERR!     at async Install.install (D:\node.js\node_modules\npm\lib\install.js:170:5)
npm ERR!  FetchError: Invalid response body while trying to fetch https://registry.npm.taobao.org/@vue%2fcli-plugin-babel: EPERM: operation not permitted, open 'D:\node.js\node_cache\_cacache\tmp\ea5120a8'
npm ERR!     at D:\node.js\node_modules\npm\node_modules\minipass-fetch\lib\body.js:162:15
npm ERR!     at async Arborist.[nodeFromEdge] (D:\node.js\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1061:19)
npm ERR!     at async Arborist.[buildDepStep] (D:\node.js\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:930:11)
npm ERR!     at async Arborist.buildIdealTree (D:\node.js\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:216:7)
npm ERR!     at async Promise.all (index 1)
npm ERR!     at async Arborist.reify (D:\node.js\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:149:5)
npm ERR!     at async Install.install (D:\node.js\node_modules\npm\lib\install.js:170:5) {
npm ERR!   code: 'EPERM',
npm ERR!   errno: 'EPERM',
npm ERR!   syscall: 'open',
npm ERR!   path: 'D:\\node.js\\node_cache\\_cacache\\tmp\\ea5120a8',
npm ERR!   type: 'system',
npm ERR!   requiredBy: '.'
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.
 ERROR  command failed: npm install --loglevel error --legacy-peer-deps

报错原因

安装Node的时候安装在D盘,导致Node.js权限不够

解决方法一

找到安装Node时候的文件夹,右键进入属性,点击安全,点击高级

进入如下界面,双击第一个用户,选定进行权限修改的对象。点击更改权限。

勾选修改权限(有人也说直接勾选完全控制,但是我只勾选了修改之后验证是可行的,保险一点还是推荐不要勾选完全控制

解决方法二

直接删除在C:\Users{账户}\下的.npmrc文件,删除之后node.js全局配置会自动恢复至C盘

还是推荐第一种方法叭

Logo

前往低代码交流专区

更多推荐