ubuntu下nodejs报错:let notifier = require('update-notifier')({pkg})
2020-07-14 06:35
585 查看
错误:
/usr/local/lib/node_modules/npm/bin/npm-cli.js:85 let notifier = require('update-notifier')({pkg}) ^^^ SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:374:25) at Object.Module._extensions..js (module.js:417:10) at Module.load (module.js:344:32) at Function.Module._load (module.js:301:12) at Function.Module.runMain (module.js:442:10) at startup (node.js:136:18) at node.js:966:3
解决办法:
1.移除错误的node_modules
cd /usr/local/lib/ rm node_modules/ -rf
2.卸载nodejs:
sudo apt-get autoremove nodejs
3.更新源,准备重新安装:
sudo apt-get update sudo apt-get install -y python-software-properties software-properties-common sudo add-apt-repository ppa:chris-lea/node.j sudo apt-get update
4.安装nodejs:
sudo apt-get install nodejs sudo apt install nodejs-legacy sudo apt install npm
5.更新npm的包镜像源,方便快速下载
sudo npm config set registry https://registry.npm.taobao.org sudo npm config list
6.全局安装n管理器(用于管理nodejs版本)
sudo npm install n -g
7.安装最新的nodejs(stable版本)
sudo n stable sudo node -v
相关文章推荐
- 【已解决】VirtualBox中安装Ubuntu到最后时卡死在:执行安装后执行的触发器update-notifier-common, ubuntu ubiquity processing trigge
- 启动nodejs项目时所遇到的一系列问题:Ubuntu下提示/usr/bin/env: node: 没有那个文件或目,Block-scoped declarations (let, const, fu
- 安装Ubuntu 12.10 进度条最后卡在update-notifier-common不动了 解决办法
- update_notifier 造成nodejs进程数量增长的问题
- nodejs Ubuntu下安装
- ubuntu下使用nvm安装nodejs
- 在Ubuntu中通过update-alternatives切换软件版本
- Ubuntu用sudo apt-get update出错:E: Problem executing scripts APT::Update::Post-Invoke-Success
- ubuntu sudo update与upgrade的作用及区别
- ubuntu 16.04 LTS - update & upgrade
- ubuntu下安装git,sublime,nodejs
- Ubuntu安装nodeJS
- 详解如何在ubuntu上安装nodejs
- Ubuntu下Vue.js+webpack的安装(nodejs版本纠正)
- ubuntu编译FFMPEG报错ERROR: x265 not found using pkg-config
- ubuntu nodejs 5.x
- 关闭Ubuntu 12.04下Update Manager开机自启动
- 在Ubuntu中通过update-alternatives切换软件版本
- Ubuntu apt-get update 失败【转】
- Ubuntu系统执行apt-get update碰到的问题及解决