部署expensify/App仓库时npm安装报错,请求排查是否为公司安全协议导致
本地部署Expensify仓库时npm安装报错问题分析
我正在本地部署GitHub仓库expensify/App,执行npm install操作时,控制台出现以下错误:
(node:17180) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [TLSSocket]. Use emitter.setMaxListeners() to increase limit npm WARN cleanup Failed to remove some directories [ npm WARN cleanup [ npm WARN cleanup 'C:\\Users\\hp\\Desktop\\Projects\\ExpensifyApp\\node_modules\\@storybook\\addon-toolbars', npm WARN cleanup [Error: EPERM: operation not permitted, rmdir 'C:\\Users\\hp\\Desktop\\Projects\\ExpensifyApp\\node_modules\\@storybook\\addon-toolbars\\node_modules\\@storybook'] { npm WARN cleanup errno: -4048, npm WARN cleanup code: 'EPERM', npm WARN cleanup syscall: 'rmdir', npm WARN cleanup path: 'C:\\Users\\hp\\Desktop\\Projects\\ExpensifyApp\\node_modules\\@storybook\\addon-toolbars\\node_modules\\@storybook' npm WARN cleanup } npm WARN cleanup ], npm WARN cleanup [ npm WARN cleanup 'C:\\Users\\hp\\Desktop\\Projects\\ExpensifyApp\\node_modules', npm WARN cleanup [Error: EPERM: operation not permitted, rmdir 'C:\\Users\\hp\\Desktop\\Projects\\ExpensifyApp\\node_modules\\@oguzhnatly\\react-native-image-manipulator\\Example\\ios\\Example'] { npm WARN cleanup errno: -4048, npm WARN cleanup code: 'EPERM', npm WARN cleanup syscall: 'rmdir', npm WARN cleanup path: 'C:\\Users\\hp\\Desktop\\Projects\\ExpensifyApp\\node_modules\\@oguzhnatly\\react-native-image-manipulator\\Example\\ios\\Example' npm WARN cleanup } npm WARN cleanup ], npm WARN cleanup [ npm WARN cleanup 'C:\\Users\\hp\\Desktop\\Projects\\ExpensifyApp\\node_modules\\@oguzhnatly', npm WARN cleanup [Error: EPERM: operation not permitted, rmdir 'C:\\Users\\hp\\Desktop\\Projects\\ExpensifyApp\\node_modules\\@oguzhnatly\\react-native-image-manipulator\\Example\\android\\app\\src\\main\\res'] { npm WARN cleanup errno: -4048, npm WARN cleanup code: 'EPERM', npm WARN cleanup syscall: 'rmdir', npm WARN cleanup path: 'C:\\Users\\hp\\Desktop\\Projects\\ExpensifyApp\\node_modules\\@oguzhnatly\\react-native-image-manipulator\\Example\\android\\app\\src\\main\\res' npm WARN cleanup } npm WARN cleanup ] npm WARN cleanup ] npm ERR! code ECONNRESET npm ERR! errno ECONNRESET npm ERR! network request to https://registry.npmjs.org/zwitch/-/zwitch-1.0.5.tgz failed, reason: Client network socket disconnected before secure TLS connection was established npm ERR! network This is a problem related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settings. npm ERR! network npm ERR! network If you are behind a proxy, please make sure that the npm ERR! network 'proxy' config is set properly.
我的网络连接正常,该仓库为公司开源仓库,我有意参与开源贡献,请问是否是公司设置的安全协议导致了这些错误?
错误原因分析及解决建议
1. 错误类型拆解
- MaxListenersExceededWarning:Node.js事件监听器数量超限警告,属于npm内部逻辑问题,一般不影响安装结果,可忽略或后续通过调整Node.js参数解决。
- EPERM权限错误:Windows系统下删除目录时权限不足,大概率是目录被其他进程(如编辑器、杀毒软件)占用,或当前用户无管理员权限。
- ECONNRESET网络错误:TLS连接建立前断开,这是核心安装失败原因,很大概率和公司网络安全策略有关——比如防火墙拦截了npm官方源的请求,或公司代理配置未正确适配npm。
2. 对应解决步骤
针对EPERM权限错误
- 关闭所有可能占用
node_modules目录的程序(如VS Code、杀毒软件); - 右键终端选择以管理员身份运行,重新执行
npm install; - 若仍失败,手动删除
node_modules目录和package-lock.json文件,再重新执行安装命令。
针对ECONNRESET网络错误
- 检查npm代理配置:执行
npm config get proxy和npm config get https-proxy,若存在代理但配置错误,联系公司IT确认正确的代理地址; - 切换npm源到公司内部镜像(如果有):执行
npm config set registry 公司内部源地址; - 若公司存在SSL证书拦截,需配置npm信任公司证书:执行
npm config set cafile "本地证书文件路径"。
3. 关于公司安全协议的疑问
是的,公司安全协议很可能是部分错误的诱因:
- ECONNRESET网络错误几乎可以确定和公司防火墙、代理或SSL拦截策略有关;
- EPERM权限错误虽多为本地问题,但也不排除公司安全软件(如终端防护工具)锁定了
node_modules目录,导致无法删除或修改。
内容的提问来源于stack exchange,提问作者Vikas
相关产品推荐
相关产品推荐

