2016-09-29 36 views
2

ElasticBeanStalkを使用してNode.JSアプリケーションをAWSにデプロイする際に問題が発生しています。 npm installスクリプト(AWSによってデフォルト)を実行している間npm installの実行中にコールバックが複数回呼び出されました

はできるだけ早く展開が始まると、私は、次の奇妙なエラーが出ます:

[email protected] node_modules/material-ui 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] ([email protected]) 
    ├── [email protected] ([email protected], [email protected]) 
    ├── [email protected] 
    ├── [email protected] ([email protected]) 
    └── [email protected] ([email protected], [email protected], [email protected], [email protected]) 
    npm ERR! Linux 4.1.17-22.30.amzn1.x86_64 
    npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v4.3.0-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v4.3.0-linux-x64/bin/npm" "--production" "install" 
    npm ERR! node v4.3.0 
    npm ERR! npm v2.14.12 

    npm ERR! Callback called more than once. 
    npm ERR! 
    npm ERR! If you need help, you may report this error at: 
    npm ERR!  <https://github.com/npm/npm/issues> 

    npm ERR! Please include the following file with any support request: 
    npm ERR!  /tmp/deployment/application/npm-debug.log 

誰もがこの問題をデバッグする私を助けることができますか?私は何が起こっているのかを理解しようとするのに、すでに多くの時間を費やしましたが、これまでのところ結果はありませんでした。

ありがとうございます!

答えて

2

どうやら一部のAWS領域が(このissueに関連して)NPMとの接続に問題がないと私はhttp代わりのhttpsを経由してモジュールをダウンロードするには、NPMを強制することによってそれを解決しました。

は、私は以下の内容を自分のプロジェクトのルートディレクトリに.npmrcファイルを追加したことを実行します。
registry= http://registry.npmjs.org/

おかげヒントについて@Jason Livesayと私は最善の解決策を見つける手助けのため@danilojun

+1

それを解決しEU-西。ほとんどの場合、単純に再試行が行われるので、実際は断続的ですが、httpを使用するともう少し決定的な結果が得られるようです。 – JHH

1

完全なログを貼り付けてください。 VMに適切なネットワークとその他のリソースがあることを確認します(無料/安いAWSのものが抑制されます)。最新のNode/npmにアップグレードしてください。 github issでこのエラーを検索すると、https://github.com/npm/npm/issues/9418#issuecomment-170244027などのgithub npm repoに関する多数のコメントが表示されます。

1

私が取り組んでいたプロジェクトで得たもう1つの解決策は、node_modulesフォルダをソースにチェックインし、自動npmインストールを無効にしてEBに継承することでした。これは、厳密な依存関係を持つ脆弱なノードアプリケーションに役立ちます。

あなたは.ebextensionsに次のスクリプトを追加する必要があります:npmを更新

files: 
    "/opt/elasticbeanstalk/hooks/appdeploy/pre/50npm.sh": 
    mode: "000755" 
    owner: root 
    group: users 
    content: | 
     #!/bin/bash 
     #============================================================================== 
     # Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved. 
     # 
     # Licensed under the Amazon Software License (the "License"). You may not use 
     # this file except in compliance with the License. A copy of the License is 
     # located at 
     # 
     #  http://aws.amazon.com/asl/ 
     # 
     # or in the "license" file accompanying this file. This file is distributed on 
     # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or 
     # implied. See the License for the specific language governing permissions 
     # and limitations under the License. 
     #============================================================================== 

     #set -xe 
     #DO NOT RUN NPM...project contains node_modules 
     #/opt/elasticbeanstalk/containerfiles/ebnode.py --action npm-install 
0

は、私が地域で展開し、今日もこの問題に遭遇した私のため

npm i -g npm 
関連する問題