npm安装包出现NO为4048的错误,一直提示说要用管理员身份登录

本文详细记录了解决在使用npm安装包时遇到的Errorno:4048错误的过程,尝试了以管理员身份运行CMD、清空npm缓存等常见方法,最终发现重启电脑是解决问题的有效方案。

在用npm安装包的时候,一直出现errorno:4048的错误,提示为用管理员身份登录。找过很多帖子,多为用管理员身份打开cmd,或者npm cache clean --force,都试过了但是不起作用,因为我也没弄清楚原因(泪奔::>_<::)

总结了几个网友说的最多的方法:

1、以管理员身份运行cmd

http://www.jianshu.com/p/8afb7f48488d

2清空npm的缓存

npm cache clean --force

3、清理垃圾数据

npm cache verify

2和3的区别我也不是很懂,这里有一篇相关帖子:https://segmentfault.com/a/119000000970921

但是,最终解决此次问题的方法是:关机

各种方法都没用,后来直接搜errorno:4048找到一篇帖子,里面说有可能是某些进程把其他不相干的文件都给锁住了,所以导致出问题。然后我就关机下班了。今天来上班,只开了Webstorm和两个浏览器。妥妥的没问题了。

 

原帖地址:

https://stackoverflow.com/questions/30860795/fail-to-install-npm-package-npm-err-errno-4048

 

转载于:https://www.cnblogs.com/coconutGirl/p/7685575.html

npm install npm WARN cleanup Failed to remove some directories [ npm WARN cleanup [ npm WARN cleanup 'E:\\安装包\\243243323906\\node_modules\\autoprefixer', npm WARN cleanup [Error: EPERM: operation not permitted, rmdir 'E:\安装包\243243323906\node_modules\autoprefixer'] { npm WARN cleanup errno: -4048, npm WARN cleanup code: 'EPERM', npm WARN cleanup syscall: 'rmdir', npm WARN cleanup path: 'E:\\安装包\\243243323906\\node_modules\\autoprefixer' npm WARN cleanup } npm WARN cleanup ], npm WARN cleanup [ npm WARN cleanup 'E:\\安装包\\243243323906\\node_modules\\debug', npm WARN cleanup [Error: EPERM: operation not permitted, rmdir 'E:\安装包\243243323906\node_modules\debug'] { npm WARN cleanup errno: -4048, npm WARN cleanup code: 'EPERM', npm WARN cleanup syscall: 'rmdir', npm WARN cleanup path: 'E:\\安装包\\243243323906\\node_modules\\debug' npm WARN cleanup } npm WARN cleanup ], npm WARN cleanup [ npm WARN cleanup 'E:\\安装包\\243243323906\\node_modules\\rxjs', npm WARN cleanup [Error: EPERM: operation not permitted, rmdir 'E:\安装包\243243323906\node_modules\rxjs'] { npm WARN cleanup errno: -4048, npm WARN cleanup code: 'EPERM', npm WARN cleanup syscall: 'rmdir', npm WARN cleanup path: 'E:\\安装包\\243243323906\\node_modules\\rxjs' npm WARN cleanup } npm WARN cleanup ], npm WARN cleanup [ npm WARN cleanup 'E:\\安装包\\243243323906\\node_modules\\framer-motion', npm WARN cleanup [Error: EPERM: operation not permitted, rmdir 'E:\安装包\243243323906\node_modules\framer-motion\dist\es'] { npm WARN cleanup errno: -4048, npm WARN cleanup code: 'EPERM', npm WARN cleanup syscall: 'rmdir', npm WARN cleanup path: 'E:\\安装包\\243243323906\\node_modules\\framer-motion\\dist\\es' npm WARN cleanup } npm WARN cleanup ] npm WARN cleanup ] npm ERR! code 1 npm ERR! path E:\安装包\243243323906\node_modules\electron npm ERR! command failed npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node install.js npm ERR! node:internal/modules/cjs/loader:1148 npm ERR! throw err; npm ERR! ^ npm ERR! npm ERR! Error: Cannot find module 'fs-extra' npm ERR! Require stack: npm ERR! - E:\安装包\243243323906\node_modules\@electron\get\dist\cjs\index.js npm ERR! - E:\安装包\243243323906\node_modules\electron\install.js npm ERR! at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15) npm ERR! at Module._load (node:internal/modules/cjs/loader:986:27) npm ERR! at Module.require (node:internal/modules/cjs/loader:1233:19) npm ERR! at require (node:internal/modules/helpers:179:18) npm ERR! at Object.<anonymous> (E:\安装包\243243323906\node_modules\@electron\get\dist\cjs\index.js:4:12) npm ERR! at Module._compile (node:internal/modules/cjs/loader:1358:14) npm ERR! at Module._extensions..js (node:internal/modules/cjs/loader:1416:10) npm ERR! at Module.load (node:internal/modules/cjs/loader:1208:32) npm ERR! at Module._load (node:internal/modules/cjs/loader:1024:12) npm ERR! at Module.require (node:internal/modules/cjs/loader:1233:19) { npm ERR! code: 'MODULE_NOT_FOUND', npm ERR! requireStack: [ npm ERR! 'E:\\安装包\\243243323906\\node_modules\\@electron\\get\\dist\\cjs\\index.js', npm ERR! 'E:\\安装包\\243243323906\\node_modules\\electron\\install.js' npm ERR! ] npm ERR! } npm ERR! npm ERR! Node.js v20.13.1 npm ERR! A complete log of this run can be found in: C:\Users\刘汶东\AppData\Local\npm-cache\_logs\2025-08-08T09_18_55_725Z-debug-0.log
08-09
npm i dayjs@1.11.13 npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. npm warn deprecated npmlog@5.0.1: This package is no longer supported. npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported npm warn deprecated are-we-there-yet@2.0.0: This package is no longer supported. npm warn deprecated gauge@3.0.2: This package is no longer supported. npm error code EPERM npm error syscall open npm error path C:\Users\s60102015\Desktop\workspace\CP_WearableCloud_HealthDeveloperService_Operation\HealthKitRunningGroupPortal\package.json npm error errno -4048 npm error Error: EPERM: operation not permitted, open 'C:\Users\s60102015\Desktop\workspace\CP_WearableCloud_HealthDeveloperService_Operation\HealthKitRunningGroupPortal\package.json' npm error at async open (node:internal/fs/promises:641:25) npm error at async writeFile (node:internal/fs/promises:1215:14) npm error at async PackageJson.save (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\package-json\lib\index.js:256:23) npm error at async [saveIdealTree] (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:1512:9) npm error at async Arborist.reify (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:148:5) npm error at async Install.exec (C:\Program Files\nodejs\node_modules\npm\lib\commands\install.js:150:5) npm error at async Npm.exec (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:207:9) npm error at async module.exports (C:\Program Files\nodejs\node_modules\npm\lib\cli\entry.js:74:5) { npm error errno: -4048, npm error code: 'EPERM', npm error syscall: 'open', npm error path: 'C:\\Users\\s60102015\\Desktop\\workspace\\CP_WearableCloud_HealthDeveloperService_Operation\\HealthKitRunningGroupPortal\\package.json' npm error } npm error npm error The operation was rejected by your operating system. npm error It's possible that the file was already in use (by a text editor or antivirus), npm error or that you lack permissions to access it. npm error npm error If you believe this might be a permissions issue, please double-check the npm error permissions of the file and its containing directories, or try running npm error the command again as root/Administrator. npm error A complete log of this run can be found in: C:\Users\s60102015\AppData\Local\npm-cache\_logs\2025-12-23T07_30_44_367Z-debug-0.log PS C:\Users\s60102015\Desktop\workspace\CP_WearableCloud_HealthDeveloperService_Operation\HealthKitRunningGroupPortal>
最新发布
12-24
npm install npm WARN cleanup Failed to remove some directories [ npm WARN cleanup [ npm WARN cleanup 'E:\\安装包\\243243323906\\node_modules\\debug', npm WARN cleanup [Error: EPERM: operation not permitted, rmdir 'E:\安装包\243243323906\node_modules\debug'] { npm WARN cleanup errno: -4048, npm WARN cleanup code: 'EPERM', npm WARN cleanup syscall: 'rmdir', npm WARN cleanup path: 'E:\\安装包\\243243323906\\node_modules\\debug' npm WARN cleanup } npm WARN cleanup ], npm WARN cleanup [ npm WARN cleanup 'E:\\安装包\\243243323906\\node_modules\\rxjs', npm WARN cleanup [Error: EPERM: operation not permitted, rmdir 'E:\安装包\243243323906\node_modules\rxjs\dist'] { npm WARN cleanup errno: -4048, npm WARN cleanup code: 'EPERM', npm WARN cleanup syscall: 'rmdir', npm WARN cleanup path: 'E:\\安装包\\243243323906\\node_modules\\rxjs\\dist' npm WARN cleanup } npm WARN cleanup ] npm WARN cleanup ] npm ERR! code 1 npm ERR! path E:\安装包\243243323906\node_modules\electron npm ERR! command failed npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node install.js npm ERR! node:internal/modules/cjs/loader:1148 npm ERR! throw err; npm ERR! ^ npm ERR! npm ERR! Error: Cannot find module 'fs-extra' npm ERR! Require stack: npm ERR! - E:\安装包\243243323906\node_modules\@electron\get\dist\cjs\index.js npm ERR! - E:\安装包\243243323906\node_modules\electron\install.js npm ERR! at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15) npm ERR! at Module._load (node:internal/modules/cjs/loader:986:27) npm ERR! at Module.require (node:internal/modules/cjs/loader:1233:19) npm ERR! at require (node:internal/modules/helpers:179:18) npm ERR! at Object.<anonymous> (E:\安装包\243243323906\node_modules\@electron\get\dist\cjs\index.js:4:12) npm ERR! at Module._compile (node:internal/modules/cjs/loader:1358:14) npm ERR! at Module._extensions..js (node:internal/modules/cjs/loader:1416:10) npm ERR! at Module.load (node:internal/modules/cjs/loader:1208:32) npm ERR! at Module._load (node:internal/modules/cjs/loader:1024:12) npm ERR! at Module.require (node:internal/modules/cjs/loader:1233:19) { npm ERR! code: 'MODULE_NOT_FOUND', npm ERR! requireStack: [ npm ERR! 'E:\\安装包\\243243323906\\node_modules\\@electron\\get\\dist\\cjs\\index.js', npm ERR! 'E:\\安装包\\243243323906\\node_modules\\electron\\install.js' npm ERR! ] npm ERR! } npm ERR! npm ERR! Node.js v20.13.1
08-09
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值