由于目录权限,Node.js部署在Amazon Elastic Beanstalk上失败
我尝试使用命令行工具在Elastic Beanstalk上安装一个简单的Node.js应用程序。
在我的git仓库上运行命令
$ eb deploy
部署我的git仓库的内容。 它部署很好,但是应用程序的健康状态是红色的。
如果我查看Elastic Beanstalk网站上的日志,它会指向我在日志中的以下错误:
> fsevents@1.0.8 install /tmp/deployment/application/node_modules/nodemon/node_modules/chokidar/node_modules/fsevents > node-pre-gyp install --fallback-to-build gyp ERR! configure error gyp ERR! stack Error: EACCES: permission denied, mkdir '/tmp/deployment/application/node_modules/nodemon/node_modules/chokidar/node_modules/fsevents/build' gyp ERR! stack at Error (native) gyp ERR! System Linux 4.1.17-22.30.amzn1.x86_64 gyp ERR! command "/opt/elasticbeanstalk/node-install/node-v4.3.0-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v4.3.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/tmp/deployment/application/node_modules/nodemon/node_modules/chokidar/node_modules/fsevents/lib/binding/Release/node-v46-linux-x64/fse.node" "--module_name=fse" "--module_path=/tmp/deployment/application/node_modules/nodemon/node_modules/chokidar/node_modules/fsevents/lib/binding/Release/node-v46-linux-x64" gyp ERR! cwd /tmp/deployment/application/node_modules/nodemon/node_modules/chokidar/node_modules/fsevents gyp ERR! node -v v4.3.0 gyp ERR! node-gyp -v v3.0.3 gyp ERR! not ok
我尝试了各种各样的事情:
- 自己创build目录(目录由root拥有)。
- 删除/ tmp中的所有内容,希望下次修复它自己。
- 删除我的node_modules目录。
这些选项都不起作用,我无法find解决方法或为什么会发生这种情况。 我可以在本地运行node.js应用程序,并将其部署到Azure和Heroku,而不会有任何问题。
花了整整一天的时间来debugging这个错误。 事实certificate,你需要在.ebignore文件中的目录的尾部斜线。
.ebignore
node_modules/
如果没有结尾的斜杠,您的本地node_modules文件夹将被上传eb – 包括开发依赖项。
我有一个类似的问题,但没有使用eb
来部署,并没有在包中包含node_modules/
。 我的解决scheme是在.npmrc
设置unsafe-perm=true
– 请参阅Beanstalk:Node.js部署 – node- .npmrc
由于权限被拒绝而失败
- 如何运行sequelize db:使用env vars在Elastic Beanstalk EB上迁移? 如何在容器命令中访问.env vars?
- 简单的aws-sdk-mock超时而不调用callback
- 亚马逊S3服务器上的Concat MP3 /媒体audio文件
- Lambda AWS不调用节点mysqlcallback
- CloudSearch的javaScript API有助于configurationfq和查询
- 如何为托pipe在Amazon ECS上的服务器运行Node.js工作?
- 在AWS上从PHP上Ping一个Node.js服务器
- 用aws nodejs sdk发送邮件(使用aws sdk nodejs文档)
- 在dynamodb预期的约束,以防止重复