2017-10-02 2 views
0

ソースコードGithub/Codeship内でgrunt testを実行すると、次のエラーが発生しました。SyntaxError:githubとcodeship内のstrictモードでのconstの使用

コードシップ内の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 

コード内のテストコマンド。

grunt test 

このエラーはソースコード内に見つかりませんでしたが、コードシップで指定された次のエラーメッセージを表示することで実際に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. 
+2

これらのセットアップコマンドを試してください: 'nvm install 6.11.3'と' nvm use 6.11.3' –

答えて

4

Because those folder structure is not defined as we configure in our server.

この問題は、フォルダ構造とは何の関係もありません。

あなたのプロジェクトでは現在ノードのバージョン0.12.6が使用されていますが、これは非常に古くなっています。ノードの現在のLTSバージョンは6.11.3であり、現在のバージョンは8.6.0です。

特定の問題はSyntaxError: Use of const in strict mode.です。これは、使用しているライブラリが現在ES2015の構文以上を使用していることを意味します。問題の根本的な原因は、Boomモジュールにあります。このモジュールでは、行番号5でconstを使用しています(他の現行の構文と同様)。

ここでの解決策は、Codeshipで使用されているノードのバージョンを更新することです。

nvm install 6.11.3 
nvm use 6.11.3 
関連する問題