ElasticBeanstalk - Ошибка компоновки веб-пакета команды контейнера - PullRequest
0 голосов
/ 15 ноября 2018

Я пытаюсь перенести мою команду сборки webpack с необходимости запуска перед загрузкой в ​​репозиторий и развертыванием на моем сервере, чтобы расширение эластичного стержня запустило команду контейнера. Я думал, что просто добавление расширения eb с npm run build сгенерирует это без каких-либо проблем, как в локальной среде, но я получаю следующую ошибку:

 Command execution failed: Activity failed. (ElasticBeanstalk::ActivityFatalError)
caused by: 
  > app@0.5.0 build /tmp/deployment/application
  > webpack


  npm ERR! Linux 4.14.47-56.37.amzn1.x86_64
  npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v6.14.3-linux-x64/bin/node" "/bin/npm" "run" "build"
  npm ERR! node v6.14.3
  npm ERR! npm  v3.10.10
  npm ERR! file sh
  npm ERR! path sh
  npm ERR! code ELIFECYCLE
  npm ERR! errno ENOENT
  npm ERR! syscall spawn sh
  npm ERR! app@0.5.0 build: `webpack`
  npm ERR! spawn sh ENOENT
  npm ERR!
  npm ERR! Failed at the app@0.5.0 build script 'webpack'.
  npm ERR! Make sure you have the latest version of node.js and npm installed.
  npm ERR! If you do, this is most likely a problem with the app package,
  npm ERR! not with npm itself.
  npm ERR! Tell the author that this fails on your system:
  npm ERR!     webpack
  npm ERR! You can get information on how to open an issue for this project with:
  npm ERR!     npm bugs app
  npm ERR! Or if that isn't available, you can get their info via:
  npm ERR!     npm owner ls app
  npm ERR! There is likely additional logging output above.
  npm ERR! Linux 4.14.47-56.37.amzn1.x86_64
  npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v6.14.3-linux-x64/bin/node" "/bin/npm" "run" "build"
  npm ERR! node v6.14.3
  npm ERR! npm  v3.10.10
  npm ERR! code ELIFECYCLE

вот файл конфигурации эластичного бобового стебля:

container_commands:
  00_npm_build:
    command: "sudo npm run build"

раздел скрипта config.json:

 "main": "app.js",
  "scripts": {
    "start": "node app.js",
    "build": "webpack",
    "test": "echo \"Error: no test specified\" && exit 1",
    "sql": "./node_modules/sequelize-cli/lib/sequelize",
    "sql:migrate": "npm run sql db:migrate"
  },

и конфигурация веб-пакета:

module.exports = {
    entry: "./public/index.js",
    output: {
        path: __dirname + "/dist",
        filename: "bundle.js"
    },
    module: {
        loaders: [
            {   
                test: /\.js$/, 
                exclude: /node_modules/, 
                loader: "babel-loader"
            },
            {   
                test: /\.jsx$/, 
                exclude: /node_modules/, 
                loader: "babel-loader"
            }
        ]
    },
};
...