gpt4 book ai didi

由于目录权限,Node.js 部署在 Amazon Elastic Beanstalk 上失败

转载 作者:搜寻专家 更新时间:2023-10-31 23:30:00 24 4
gpt4 key购买 nike

我正在尝试使用命令行工具在 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

我尝试了各种方法,例如:

  1. 自己创建目录(目录归 root 所有)。
  2. 从/tmp 中删除所有内容,希望下次它能自行修复。
  3. 正在删除我的 node_modules 目录。

这些选项都不起作用,我找不到解决方法或发生这种情况的原因。我可以在本地运行 node.js 应用程序,也可以毫无问题地将它部署到 Azure 和 Heroku。

最佳答案

我遇到了类似的问题,但没有使用 eb 进行部署,也没有在包中包含 node_modules/ 。对我有用的解决方案是在 .npmrc 中设置 unsafe-perm=true - 参见 Beanstalk: Node.js deployment - node-gyp fails due to permission denied

关于由于目录权限,Node.js 部署在 Amazon Elastic Beanstalk 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36141255/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com