AWS эластичный beanstalk - ПРЕДУПРЕЖДАЕТ установить EACCES: разрешение запрещено, доступ '/tmp/.npm' - PullRequest
0 голосов
/ 02 июля 2019

Может ли кто-нибудь помочь мне избавиться от следующей ошибки -

WARN install EACCES: permission denied, access '/tmp/.npm'
  gyp ERR! clean error 
  gyp ERR! stack Error: EACCES: permission denied, rmdir 'build/bindings'
  gyp ERR! System Linux 4.14.123-86.109.amzn1.x86_64
  gyp ERR! command "/opt/elasticbeanstalk/node-install/node-v10.16.0-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v10.16.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
  gyp ERR! cwd /tmp/deployment/application/node_modules/iltorb
  gyp ERR! node -v v10.16.0
  gyp ERR! node-gyp -v v3.8.0
  gyp ERR! not ok 
  npm ERR! code ELIFECYCLE
  npm ERR! errno 1
  npm ERR! iltorb@2.4.3 install: `node ./scripts/install.js || node-gyp rebuild`
  npm ERR! Exit status 1
  npm ERR! 
  npm ERR! Failed at the iltorb@2.4.3 install script.
  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Я попробовал следующие решения - 1. создал файл под .elasticbeanstalk dir со следующими кодами -

files:
  "/opt/elasticbeanstalk/hooks/appdeploy/post/99_fix_node_permissions.sh":
    mode: "000755"
    owner: root
    group: root
    content: |
      #!/usr/bin/env bash
      chown -R nodejs:nodejs /tmp/.npm/

Обновлен тип экземпляра до t2.medium, чтобы избежать исключений, связанных с памятью

Ниже приведен мой config.yaml файл

enter image description here*Файл 1018 *

и package.json имеет следующее содержимое -

{
  "name": "shards-dashboard-lite-react",
  "version": "1.0.0",
  "private": true,
  "homepage": "./",
  "dependencies": {
    "camelize": "^1.0.0",
    "chart.js": "^2.7.3",
    "classnames": "^2.2.6",
    "cross-env": "^5.2.0",
    "dateformat": "^3.0.3",
    "flux": "^3.1.3",
    "lodash.find": "^4.6.0",
    "react": "^16.6.3",
    "react-dom": "^16.6.3",
    "react-ga": "^2.5.6",
    "react-quill": "^1.3.3",
    "react-router-dom": "^4.3.1",
    "react-scripts": "2.1.1",
    "shards-react": "^1.0.0",
    "shortid": "^2.2.14"
  },
  "scripts": {
    "start": "set PORT=8081 && react-scripts start",
    "build:prod": "npm run build",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ]
}

Большое спасибо !!

1 Ответ

0 голосов
/ 02 июля 2019

Попробовав все, наконец-то у меня сработало следующее решение:)

Решение - добавить файл .npmrc в корневой каталог приложения с содержимым:

# Force npm to run node-gyp also as root, preventing permission denied errors in AWS with npm@5
unsafe-perm=true

Ссылка -

Beanstalk: развертывание Node.js - сбой узла узла из-за отклоненного разрешения

...