npm install 在“eb create”节点 6.2.2 上失败

Posted

技术标签:

【中文标题】npm install 在“eb create”节点 6.2.2 上失败【英文标题】:npm install fails on `eb create` Node 6.2.2 【发布时间】:2017-02-04 13:27:25 【问题描述】:

还有其他人有这个问题吗?

1620 verbose unsafe-perm in lifecycle false
1621 info bufferutil@1.2.1 Failed to exec install script
1622 verbose stack Error: bufferutil@1.2.1 install: `node-gyp rebuild`
1622 verbose stack Exit status 1
1622 verbose stack at EventEmitter.<anonymous> (/opt/elasticbeanstalk/node-install/node-v4.4.6-linux-x64/lib/node_modules/npm/lib/utils/lifecycle.js:217:16)
1622 verbose stack at emitTwo (events.js:87:13)
1622 verbose stack at EventEmitter.emit (events.js:172:7)
1622 verbose stack at ChildProcess.<anonymous> (/opt/elasticbeanstalk/node-install/node-v4.4.6-linux-x64/lib/node_modules/npm/lib/utils/spawn.js:24:14)
1622 verbose stack at emitTwo (events.js:87:13)
1622 verbose stack at ChildProcess.emit (events.js:172:7)
1622 verbose stack at maybeClose (internal/child_process.js:827:16)
1622 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
1623 verbose pkgid bufferutil@1.2.1
1624 verbose cwd /tmp/deployment/application
1625 error Linux 4.4.14-24.50.amzn1.x86_64
1626 error argv "/opt/elasticbeanstalk/node-install/node-v4.4.6-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v4.4.6-linux-x64/bin/npm" "--production" "install"
1627 error node v4.4.6
1628 error npm v2.15.5
1629 error code ELIFECYCLE
1630 error bufferutil@1.2.1 install: `node-gyp rebuild`
1630 error Exit status 1
1631 error Failed at the bufferutil@1.2.1 install script 'node-gyp rebuild'.
1631 error This is most likely a problem with the bufferutil package,
1631 error not with npm itself.
1631 error Tell the author that this fails on your system:
1631 error node-gyp rebuild
1631 error You can get information on how to open an issue for this project with:
1631 error npm bugs bufferutil
1631 error Or if that isn't available, you can get their info via:
1631 error
1631 error npm owner ls bufferutil
1631 error There is likely additional logging output above.
1632 verbose exit 1, true 

/var/log/eb-activity.log
Running npm with --production flag
Failed to run npm install. Snapshot logs for more details.
Traceback (most recent call last):
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 695, in <module>
main()
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 677, in main
node_version_manager.run_npm_install(options.app_path)
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 136, in run_npm_install
self.npm_install(bin_path, self.config_manager.get_container_config('app_staging_dir'))
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 180, in npm_install
raise e
subprocess.CalledProcessError: Command '' returned non-zero exit status 1 (ElasticBeanstalk::ExternalInvocationError)
caused by: + /opt/elasticbeanstalk/containerfiles/ebnode.py --action npm-install

bufferutil@1.2.1 install /tmp/deployment/application/node_modules/bufferutil
node-gyp rebuild

gyp ERR! clean error
gyp ERR! stack Error: EACCES: permission denied, rmdir 'build'
gyp ERR! stack at Error (native)
gyp ERR! System Linux 4.4.14-24.50.amzn1.x86_64
gyp ERR! command "/opt/elasticbeanstalk/node-install/node-v4.4.6-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v4.4.6-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /tmp/deployment/application/node_modules/bufferutil
gyp ERR! node -v v4.4.6
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok

npm ERR! Linux 4.4.14-24.50.amzn1.x86_64
npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v4.4.6-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v4.4.6-linux-x64/bin/npm" "--production" "install"
npm ERR! node v4.4.6
npm ERR! npm v2.15.5
npm ERR! code ELIFECYCLE
npm ERR! bufferutil@1.2.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bufferutil@1.2.1 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the bufferutil package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs bufferutil
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls bufferutil
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /tmp/deployment/application/npm-debug.log
Running npm install: /opt/elasticbeanstalk/node-install/node-v4.4.6-linux-x64/bin/npm
Setting npm config jobs to 1
npm config jobs set to 1
Running npm with --production flag
Failed to run npm install. Snapshot logs for more details.
Traceback (most recent call last):
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 695, in <module>
main()
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 677, in main
node_version_manager.run_npm_install(options.app_path)
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 136, in run_npm_install
self.npm_install(bin_path, self.config_manager.get_container_config('app_staging_dir'))
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 180, in npm_install
raise e
subprocess.CalledProcessError: Command '' returned non-zero exit status 1 (Executor::NonZeroExitStatus)

【问题讨论】:

npm ERR! Tell the author that this fails on your system: npm ERR! node-gyp rebuild 看起来您回答了自己的问题。 但是世界各地的 Elastic Beanstalk 用户不会因为这个原因在他们的 Node.js 部署中失败,可以吗?我只是想知道是否有人可能在这方面有更多经验。也许问题不是 node-gyp 重建……也许是内存问题等 不知道怎么可能是内存问题。你看过 NPM 日志文件了吗? 只是说这可能是我们忽略的东西...... 哇,成功了! ***.com/questions/36141255/… 基本上我应该将 node_modules 添加到 .ebignore 【参考方案1】:

基本上我只是将 node_modules/ 添加到 .ebignore 并且它起作用了。

Node.js deployment fails on Amazon Elastic Beanstalk due to directory permissions

【讨论】:

以上是关于npm install 在“eb create”节点 6.2.2 上失败的主要内容,如果未能解决你的问题,请参考以下文章

Elastic beanstalk - eb create 无法创建 AWSEBRDSDBSecurityGroup

eb create 错误:LargeZipFile :: 文件数需要 ZIP64 扩展名

带有 Django 的 AWS Beanstalk:eb create 抱怨未知配置设置“StaticFile”

npm install --save 和 npm install -d的区别

npm install -g 和npm install --save-dev的关系

`npm install` 与 Meteor 1.3 中的 `meteor npm install` 相同吗?