SyntaxError:在github和codeship中使用严格模式的const

PPS*_*ein 0 github node.js codeship sparkpost

当我grunt test在源代码Github/Codeship中运行时,我发现以下错误.

在代码内部的setup命令中,以下代码配置如下.

nvm install 0.12.6
nvm use 0.12.6
npm install grunt-cli bower -g
npm install
bower install -p
npm run update-webdriver
Run Code Online (Sandbox Code Playgroud)

代码内的测试命令;

grunt test
Run Code Online (Sandbox Code Playgroud)

但是在我的源代码中找不到该错误,并且通过查看codeship给出的以下错误消息实际上在github/codeship中找到了该错误.因为我们在服务器中配置的文件夹结构没有定义.请帮我解决一下.谢谢.

Using 2 x hasMany to represent N:M relations has been deprecated. Please use belongsToMany instead
>> Mocha exploded!
>> /home/rof/src/github.com/MyProjects/node_modules/sparkpost/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js:5
>> const Hoek = require('hoek');
>> ^^^^^
>> SyntaxError: Use of const in strict mode.
>>     at exports.runInThisContext (vm.js:73:16)
>>     at Module._compile (module.js:443:25)
>>     at Object.Module._extensions..js (module.js:478:10)
>>     at Module.load (module.js:355:32)
>>     at Function.Module._load (module.js:310:12)
>>     at Module.require (module.js:365:17)
>>     at require (module.js:384:17)
>>     at Object.<anonymous> (/home/rof/src/github.com/MyProjects/node_modules/sparkpost/node_modules/request/node_modules/hawk/lib/index.js:5:33)
>>     at Module._compile (module.js:460:26)
>>     at Object.Module._extensions..js (module.js:478:10)
>>     at Module.load (module.js:355:32)
>>     at Function.Module._load (module.js:310:12)
>>     at Module.require (module.js:365:17)
>>     at require (module.js:384:17)
>>     at Object.<anonymous> (/home/rof/src/github.com/MyProjects/node_modules/sparkpost/node_modules/request/request.js:9:12)
>>     at Module._compile (module.js:460:26)
Warning: Task "mochaTest:src" failed. Use --force to continue.
Run Code Online (Sandbox Code Playgroud)

Kel*_*ews 5

因为我们在服务器中配置的文件夹结构没有定义.

此问题与文件夹结构无关.

您的项目当前正在使用0.12.6非常过时的Node版本.Node的当前LTS版本是6.11.3当前版本8.6.0.

具体问题是SyntaxError: Use of const in strict mode.,您使用的库目前正在使用ES2015语法或更高版本.问题的根本原因在于Boom模块,它使用const第5行(也很可能是其他当前语法).

此问题的解决方案是更新Codeship中使用的节点版本.

nvm install 6.11.3
nvm use 6.11.3
Run Code Online (Sandbox Code Playgroud)