AWS EB部署问题

AWS EB部署问题

问题描述:

我试图将一个Node.js应用程序部署到Elastic Beanstalk。该应用在本地正常工作。然而,当我尝试部署,我得到的错误:AWS EB部署问题

Failed to run npm install. Snapshot logs for more details. 

这里是EB日志更详细的截图: enter image description here

错误日志(我觉得它很有趣,我得到许可被拒绝 - 那会是什么意思):

/var/log/eb-activity.log 
------------------------------------- 
    npm ERR! path /tmp/.npm/node-linux-x64 
    npm ERR! code EACCES 
    npm ERR! errno -13 
    npm ERR! syscall mkdir 

    npm ERR! Error: EACCES: permission denied, mkdir '/tmp/.npm/node-linux-x64' 
    npm ERR!  at Error (native) 
    npm ERR! { Error: EACCES: permission denied, mkdir '/tmp/.npm/node-linux-x64' 
    npm ERR!  at Error (native) 
    npm ERR! errno: -13, 
    npm ERR! code: 'EACCES', 
    npm ERR! syscall: 'mkdir', 
    npm ERR! path: '/tmp/.npm/node-linux-x64', 
    npm ERR! parent: 'node' } 
    npm ERR! 
    npm ERR! Please try running this command again as root/Administrator. 
    npm ERR! Linux 4.9.58-18.55.amzn1.x86_64 
    npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v6.11.5-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v6.11.5-linux-x64/bin/npm" "install" "--no-save" "[email protected]" 
    npm ERR! node v6.11.5 
    npm ERR! npm v3.10.10 
    npm ERR! path npm-debug.log.487421323 
    npm ERR! code EACCES 
    npm ERR! errno -13 
    npm ERR! syscall open 

    npm ERR! Error: EACCES: permission denied, open 'npm-debug.log.487421323' 
    npm ERR!  at Error (native) 
    npm ERR! { Error: EACCES: permission denied, open 'npm-debug.log.487421323' 
    npm ERR!  at Error (native) 
    npm ERR! errno: -13, 
    npm ERR! code: 'EACCES', 
    npm ERR! syscall: 'open', 
    npm ERR! path: 'npm-debug.log.487421323' } 
    npm ERR! 
    npm ERR! Please try running this command again as root/Administrator. 

    npm ERR! Please include the following file with any support request: 
    npm ERR!  /tmp/deployment/application/node_modules/node/npm-debug.log 
    module.js:471 
     throw err; 
    ^

    Error: Cannot find module 'node-linux-x64/package.json' 
     at Function.Module._resolveFilename (module.js:469:15) 
     at Function.resolve (internal/module.js:27:19) 
     at ChildProcess.<anonymous> (/tmp/deployment/application/node_modules/node-bin-setup/index.js:18:27) 
     at emitTwo (events.js:106:13) 
     at ChildProcess.emit (events.js:191:7) 
     at maybeClose (internal/child_process.js:920:16) 
     at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5) 

    npm ERR! Linux 4.9.58-18.55.amzn1.x86_64 
    npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v6.11.5-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v6.11.5-linux-x64/bin/npm" "--production" "rebuild" 
    npm ERR! node v6.11.5 
    npm ERR! npm v3.10.10 
    npm ERR! code ELIFECYCLE 
    npm ERR! [email protected] preinstall: `node installArchSpecificPackage` 
    npm ERR! Exit status 1 
    npm ERR! 
    npm ERR! Failed at the [email protected] preinstall script 'node installArchSpecificPackage'. 
    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 node package, 
    npm ERR! not with npm itself. 
    npm ERR! Tell the author that this fails on your system: 
    npm ERR!  node installArchSpecificPackage 
    npm ERR! You can get information on how to open an issue for this project with: 
    npm ERR!  npm bugs node 
    npm ERR! Or if that isn't available, you can get their info via: 
    npm ERR!  npm owner ls node 
    npm ERR! There is likely additional logging output above. 

的package.json:

{ 
    "name": "MyProject", 
    "version": "0.0.1", 
    "private": true, 
    "dependencies": { 
    "body-parser": "latest", 
    "express": "latest", 
    "node": "latest", 
    "nodemailer": "latest" 
    }, 
    "scripts": { 
    "start": "node app.js" 
    } 
} 

这是为什么发生?

编辑:添加package.json和错误日志按要求。

+2

那么日志文件是怎么说的? – stdunbar

+0

请发布您的'package.json',至少脚本部分 –

+1

用log和package.json编辑我的帖子 –

在没有信息去了,这里有一些猜测:

  • 要手动压缩和上传您的应用程序。 Use the CLI tools,出于某种原因eb deploy总是去平滑
  • 你是在一个非常小的情况下,你需要升级到一个有足够的内存来处理你的依赖

如果这些不帮助,请发表您的package.json 。或者,只需使用Up,它比Beanstalk容易得多。

+0

你在说什么这些CLI工具?我只看到了在EB部署过程中手动上传应用程序的选项。 –

+0

这里是一个使用EB CLI和Node的教程https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_nodejs_express.html –

+0

我尝试使用CLI,但它仍然不起作用。我认为这个问题主要是在EACCS权限的拒绝。 –