Nie*_*lsJ 6 amazon-web-services amazon-elastic-beanstalk npm-install
我对 AWS 比较陌生。我在 Elastic Beanstalk 上运行 Node.JS 应用程序,一切正常。但是,因为我需要进行一些图像处理,所以我决定添加 Puppeteer 和 Sharp。
但是,在 AWS 上安装失败,应用程序崩溃。日志说如下:
sharp@0.21.3 install /tmp/deployment/application/node_modules/sharp
(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
ERR! sharp EACCES: permission denied, mkdir '/tmp/.npm/_libvips'
info sharp Attempting to build from source via node-gyp but this may fail due to the above error
info sharp Please see https://sharp.pixelplumbing.com/page/install for required dependencies
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/tmp/deployment/application/node_modules/sharp/build'
gyp ERR! System Linux 4.14.97-74.72.amzn1.x86_64
gyp ERR! command "/opt/elasticbeanstalk/node-install/node-v10.15.1-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v10.15.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /tmp/deployment/application/node_modules/sharp
gyp ERR! node -v v10.15.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.21.3 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sharp@0.21.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Run Code Online (Sandbox Code Playgroud)
我真的不熟悉 Elastic Beanstalk,但这似乎是一个访问限制错误。经过一番搜索,我找到了一个可能的解决方案:将以下代码添加为 .extension 文件。
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/00_set_tmp_permissions.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
chown -R nodejs:nodejs /tmp/.npm
Run Code Online (Sandbox Code Playgroud)
然而,这似乎没有任何作用。有谁知道错误可能在哪里?或者我应该在哪里寻找解决方案?我通常不在家处理这种东西,但我不得不使用它一段时间。任何帮助和建议将不胜感激!
小智 6
这是 AWS 的权限问题。
要解决此问题,您必须执行以下步骤:
这将允许写入文件。
| 归档时间: |
|
| 查看次数: |
620 次 |
| 最近记录: |