【bug记录】启动前端项目npm install 报错解决过程

启动前端项目时,使用npm install命令一直报错

公司内 node.js 有使用12版本,有使用14版本,故都试了一遍,结果都不能 install 成功
使用 node.js 12.16.2:

25012 error code EPERM
25013 error syscall unlink
25014 error path F:\xxxxx\node_modules\.staging\echarts-2ca3fbc1\dist\echarts-en.js
25015 error errno -4048
25016 error Error: EPERM: operation not permitted, unlink 'F:\xxxxx\node_modules\.staging\echarts-2ca3fbc1\dist\echarts-en.js'
25016 error  [OperationalError: EPERM: operation not permitted, unlink 'F:\xxxxx\node_modules\.staging\echarts-2ca3fbc1\dist\echarts-en.js'] {
25016 error   cause: [Error: EPERM: operation not permitted, unlink 'F:\xxxxx\node_modules\.staging\echarts-2ca3fbc1\dist\echarts-en.js'] {
25016 error     errno: -4048,
25016 error     code: 'EPERM',
25016 error     syscall: 'unlink',
25016 error     path: 'F:\\xxxxx\\node_modules\\.staging\\echarts-2ca3fbc1\\dist\\echarts-en.js'
25016 error   },
25016 error   stack: "Error: EPERM: operation not permitted, unlink 'F:\\xxxxx\\node_modules\\.staging\\echarts-2ca3fbc1\\dist\\echarts-en.js'",
25016 error   errno: -4048,
25016 error   code: 'EPERM',
25016 error   syscall: 'unlink',
25016 error   path: 'F:\\xxxxx\\node_modules\\.staging\\echarts-2ca3fbc1\\dist\\echarts-en.js',
25016 error   parent: 'dsm-front'
25016 error }
25017 error The operation was rejected by your operating system.
25017 error It's possible that the file was already in use (by a text editor or antivirus),
25017 error or that you lack permissions to access it.
25017 error
25017 error If you believe this might be a permissions issue, please double-check the
25017 error permissions of the file and its containing directories, or try running
25017 error the command again as root/Administrator.

使用 node.js 14.21.3:

npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     <https://npm.community>

多种尝试无果

在网上搜了很多很多方法,但是都没有效果

使用管理员权限打开,删除C:\user\用户名.npmrc 文件,修改镜像,这些方法都没有用

npm install -f 也是报同样的错

删除根目录下 node_modules 文件 执行npm cache clean --force 没有效果

解决方案

通过看报错日志发现主要原因是找不到 ‘npm sass’ 包

使用nodejs v12版本,打开魔法,安装python 2.7.13,删除根目录下的node_modules包,重新 npm install,完美解决

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值