【发布时间】:2020-09-23 15:50:07
【问题描述】:
每当我运行任何“npm”命令时,都会收到此错误。
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
我的节点版本
node -v
> v4.2.6
我相信最新的是 14,但我也无法更新它。
我试过跑步
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
然后,
sudo apt-get install -y nodejs
>Reading package lists... Done
Building dependency tree
Reading state information... Done
nodejs is already the newest version (4.2.6~dfsg-1ubuntu4.2).
0 upgraded, 0 newly installed, 0 to remove and 50 not upgraded.
【问题讨论】:
-
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -是成功了还是失败了? -
好像成功了。最后它说 ## Run
sudo apt-get install -y nodejs安装 Node.js 12.x 和 npm
标签: node.js linux ubuntu npm node-modules