Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

报错 Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
解决方法 :
1.在文件头添加”javascript 严格模式”声明
在这里插入图片描述
2.更新nodejs
用n升级nodejs
1.安装n

npm install -g n(如果不是root下,需要加sudo)

2.升级到最新稳定版

n stable

3.n升级到最新版

n latest

4.查看版本

node -v
n -V

你可能感兴趣的:(Block-scoped declarations (let, const, function, class) not yet supported outside strict mode)