Elastic Beanstalk 部署失败、权限被拒绝、mkdir [英] Elastic Beanstalk deployment failure, permission denied, mkdir

查看:51
本文介绍了Elastic Beanstalk 部署失败、权限被拒绝、mkdir的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 GRPC 依赖项添加到节点弹性 beanstalk 应用程序,但我的所有部署都失败了.从我的 package.json 中删除 GRPC 依赖项后,我的部署工作.

I'm attempting to add the GRPC dependency to a node elastic beanstalk application and all of my deployments are failing. Once I remove the GRPC dependency from my package.json my deployments work.

错误是

ERROR: Failed to run npm install.  
> grpc@1.10.1 install /tmp/deployment/application/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp ERR! Pre-built binaries not installable for grpc@1.10.1 
and node@8.9.3 (node-v57 ABI, glibc) (falling back to source compile 
with node-gyp) 
node-pre-gyp ERR! Hit error EACCES: permission denied, mkdir 
'/tmp/deployment/application/node_modules/grpc/src/node' 
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied

我在另一个节点应用程序上遇到了这个问题,并且能够通过运行 npm --save-dev eb-fix-npm 来解决它,但它不适用于这个应用程序.我有时也会收到类似无法创建符号链接,文件已经存在(释义)"的错误.

I've had this issue on another node app and was able to resolve it by running npm --save-dev eb-fix-npm but it does not work with this app. I also sometimes get an error along the lines of `cannot create symbolic link, file already exists (paraphrased).

我也设置了这个文件来尝试解决这个问题.

I have this file set up as well to attempt to fix this.

 files:
   "/opt/elasticbeanstalk/hooks/appdeploy/pre/50npm.sh" :
     mode: "000775"
     owner: root
     group: root
     content: |
       #!/bin/bash          
       function error_exit

       {
         eventHelper.py --msg "$1" --severity ERROR
         exit $2
       }

       export HOME=/home/ec2-user

       OUT=$(/opt/elasticbeanstalk/containerfiles/ebnode.py --action npm-install 2>&1) || error_exit "Failed to run npm install.  $OUT" $?
       echo $OUT

感谢您的帮助

推荐答案

我能够通过以下文件解决此问题 --> .ebextensions/00_dir_permission.config.希望这对其他人有帮助

I was able to resolve this by the following file --> .ebextensions/00_dir_permission.config. Hope this helps someone else

files:
  "/opt/elasticbeanstalk/hooks/appdeploy/pre/00_set_tmp_permissions.sh":
    mode: "000755"
    owner: root
    group: root
    content: |
      #!/usr/bin/env bash
      chown -R ec2-user /tmp
      chown -R $USER:$(id -gn $USER) /tmp/.config
      chown -R nodejs:nodejs /tmp/.npm

这篇关于Elastic Beanstalk 部署失败、权限被拒绝、mkdir的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆