Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/449.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 运行节点4.4.7时收到严格模式警告_Javascript_Node.js_Ecmascript 6_Let_Strict - Fatal编程技术网

Javascript 运行节点4.4.7时收到严格模式警告

Javascript 运行节点4.4.7时收到严格模式警告,javascript,node.js,ecmascript-6,let,strict,Javascript,Node.js,Ecmascript 6,Let,Strict,我相信节点v4.4.7支持ES6。但是,节点拒绝编译我的程序: user1-$ node -v v4.4.7 user1-$ node index.js event-service.js:85 let sql = 'SELECT * FROM group_events where id = ?'; ^^^ SyntaxError: Block-scoped declarations (let, const, function, class) not yet suppo

我相信节点v4.4.7支持ES6。但是,节点拒绝编译我的程序:

user1-$ node -v
v4.4.7

user1-$ node index.js
event-service.js:85
      let sql = 'SELECT * FROM group_events where id = ?';
      ^^^

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

我想避免“严格使用”。还有其他选项吗?

运行
节点--使用严格索引.js
强制使用严格模式运行
节点--使用严格索引.js
强制使用严格模式运行可能是这个答案?我不想在每个文件上都加上“use strict”。还有其他选择吗?我认为在v4.x中,节点默认是在严格模式下运行的。维尔德。尝试运行
节点--使用_strictindex.js
为什么不切换到较新的节点版本?当前的稳定版本对ES6的支持要好得多。@GrégoryNEUT将您的回答作为一个答案,以便我可以将其标记为可能是这个答案吗?我不想在每个文件上都加上“use strict”。还有其他选择吗?我认为在v4.x中,节点默认是在严格模式下运行的。维尔德。尝试运行
节点--使用_strictindex.js
为什么不切换到较新的节点版本?当前的稳定版本对ES6的支持要好得多。@GrégoryNEUT将您的回答作为一个答案,这样我就可以这样标记了