2

Node.jsアプリケーションを弾力のあるbeanstalkにデプロイしようとしています。問題は、毎回起動スクリプトで失敗することです。 ec2は起動スクリプトnpm startを使用するように設定されており、node app.js(package.jsonで定義されています)を実行します。ただし、この起動スクリプトはec2で失敗します。ログに記録されたエラーが表示されます。起動スクリプトで弾力のあるBeanstalkが失敗する

npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the myProject start script 'node app.js'. 
npm ERR! Make sure you have the latest version of node.js and npm installed. 
npm ERR! If you do, this is most likely a problem with the Portfolio package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  node app.js 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs myProject 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR!  npm owner ls myProject 
npm ERR! There is likely additional logging output above. 

これはどういう意味ですか? npm startを、AWSに圧縮された同じアプリケーションのルートディレクトリにあるコマンドラインで実行すると、localhost上で動作します。私はまた、両方のNPMを更新しました。ここで

をNode.jsのは、構造が展開する圧縮ファイルです:

.zipファイル

  • node_modules/
  • 公共/
  • app.js
  • package.json
  • package-lock.json

答えて

2

npmの依存関係がないために発生したElastic Beanstalkの同様の問題が発生しました。いくつかの依存関係はnode_modulesにローカルにインストールされましたが、1つまたは2つはグローバルにインストールされているため、展開のために圧縮するときにパッケージ化されません。残念ながら、Elastic Beanstalkのエラーメッセージは、この場合には役に立たず、一般的なエラーが発生します。

+0

あなたはこれを回避する方法を見つけましたか? –

+0

はい。まず、プロジェクトが依存しているすべてのnpmの依存関係が 'package.json'ファイルにあることを絶対に確かめてください。次に、ターミナルやコマンドラインのディレクトリをプロジェクトのルートに切り替え、 'npm install'を実行します。' node_modules'フォルダに 'package.json'ファイルで指定された正しい依存関係が設定されていることを確認します。詳細については、[この質問](https://stackoverflow.com/questions/8367031/how-do-i-install-package-json-dependencies-in-the-current-directory-using-npm)を参照してください。 –

関連する問題