简体   繁体   English

const os = require('os')SyntaxError:在严格模式下使用const

[英]const os = require('os') SyntaxError: Use of const in strict mode

While building application with Teamcity 9.1.7 we are getting below error - 在使用Teamcity 9.1.7构建应用程序时,我们遇到了以下错误-

const os = require('os'); const os = require('os'); ^^^^^ ^^^^^

Loading "Gruntfile.js" tasks...ERROR 正在加载“ Gruntfile.js”任务...错误

SyntaxError: Use of const in strict mode. SyntaxError:在严格模式下使用const。

Any help is greatly appriciated 任何帮助都非常有用

add 'use strict'; 添加'use strict'; to the top of the file. 到文件顶部。 Or better update your node.js 或者更好地更新您的node.js

'use strict';
const os = require('os');
// rest of the file

For your version of node (6.11.3 as you've mentioned in comment) everything should works fine. 对于您的节点版本(如您在注释中提到的6.11.3),一切正常。 I've just checked 我刚检查

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 语法错误:在严格模式下使用 const - SyntaxError: Use of const in strict mode Visual Studio 任务运行程序“语法错误:在严格模式下使用 const。” - Visual Studio Task Runner "SyntaxError: Use of const in strict mode." 未捕获的SyntaxError:在严格模式下使用const Travis-ci业力测试与铬投掷 - Uncaught SyntaxError: Use of const in strict mode | Travis-ci karma test with chromium throws npm start命令我遇到了语法错误:在严格模式下使用const - npm start command I am getting syntaxerror: use of const in strict mode Typescript和Uncaught SyntaxError:在严格模式之外尚不支持块范围的声明(let,const,function,class) - Typescript and Uncaught SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode 严格模式下函数的SyntaxError - SyntaxError for functions in strict mode 如果要求失败,const行为 - Const behaviour if require fails SyntaxError:'with'语句在严格模式下无效 - SyntaxError: 'with' statements are not valid in strict mode 我应该如何实例化一个使用外部const require的对象 - How should I instantiate an object which use external const require AngularJS:严格模式之外尚不支持块范围的声明(let,const,函数,类) - AngularJS: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM