关于nodejs升级那些事

最近项目中引用了一个导出工具的第三方依赖,需要进行nodejs的升级,结果直接安装和webpack打包报错了,记录了一下内容和处理过程

Building legacy bundle for test…
Browserslist: caniuse-lite is outdated. Please run next command npm update
Browserslist: caniuse-lite is outdated. Please run next command npm update
Browserslist: caniuse-lite is outdated. Please run next command npm update
Browserslist: caniuse-lite is outdated. Please run next command npm update

Fatal error in , line 0
API fatal error handler returned after process out of memory
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! admin@1.0.0 build:test: cross-env npm run buildapp:test && npm run buildlib:test
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the admin@1.0.0 build:test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/dmadmin/.npm/_logs/2021-03-23T03_42_29_558Z-debug.log
Build step ‘Execute shell’ marked build as failure
SSH: Current build result is [FAILURE], not going to run.
Finished: FAILURE

升级node,目前亲测升级到14.16.0,升级后npm install出现以下问题,三步命令可以一起完成

问题一
Error: Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime (83)
For more information on which environments are supported please see:https://github.com/sass/node-sass/releases/tag/v4.11.0

删除node_modules重新安装,如果rm会卡住用npm安装 rimraf进行删除,如下

npm install rimraf -g
rimraf node_modules

问题二
npm ERR! code 1
npm ERR! path /home/dmadmin/.jenkins/workspace/test_dcxy_manage_shell/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! make: 进入目录“/home/dmadmin/.jenkins/workspace/test_dcxy_manage_shell/node_modules/node-sass/build”

删除package-lock.json

rm -f package-lock.json

问题三
Error: ENOENT: no such file or directory, scandir ‘/home/dmadmin/.jenkins/workspace/test_dcxy_manage_shell/node_modules/node-sass/vendor’

npm rebuild node-sass --save-dev

总结:需要多看错误内容,根据内容找解决办法

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值