记录一次项目升级node版本

1.使用nvm下载14.17.5版本node,发现没有npm。

报错:bash: npm: command not found

解决方法:nvm安装node没有npm的问题 - 简书

2.删除node_modules和package-lock.json,重新安装发现报错

npm ERR! git@github.com: Permission denied (publickey). npm ERR! fatal: Could not read from remote repository.

解决方法:在 github 增加 SSH

3. npm安装canvas时报错

npm ERR! Failed at the canvas@2.0.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

解决方法:使用淘宝镜像npm install canvas --canvas_binary_host_mirror=CNPM Binaries Mirror

网上搜索到的链接都没有用,最后是在这里找到的。参考链接:https://gist.github.com/long-woo/ce94ec063aa392589b9996bfeaf27971

4. 报错:Syntax Error: Error: ENOENT: no such file or directory, scandir 'D:\FTL-Workspace\project\tms-web\node_modules\node-sass\vendor'

解决方法:npm rebuild node-sass

5.提示:TypeError: token.type.endsWith is not a function

解决方法:移除babel-eslint

添加 npm install eslint @babel/core @babel/eslint-parser --save-dev

并且将.eslinttrc.js文件中的

 parserOptions: {
   // babel-eslint 改为 @babel/eslint-parser
   parser: '@babel/eslint-parser'
 }

最后重启项目

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值