当前位置: 首页 > 工具软件 > Notifier.js > 使用案例 >

npm -v /usr/local/lib/node_modules/npm/bin/npm-cli.js:87 not yet supported outside strict mode

单于经纬
2023-12-01

root@acme-peer-0:/var/hyperledger/bins# npm -v

/usr/local/lib/node_modules/npm/bin/npm-cli.js:87
      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

 

原因:nodejs版本太老

解决方法

# 删除nodejs
apt-get remove nodejs

# nodejs源
curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -

# 更新包
apt-get update  

# 安装nodejs
apt-get install nodejs  

# 更新npm
npm install npm -g

 

https://blog.csdn.net/ipfpm/article/details/82999916

 

 

 

 类似资料: