Ошибка развертывания приложения rails app / w webpack JS в Heroku - PullRequest
0 голосов
/ 11 апреля 2020

Вот конкретная c ошибка, о которой идет речь:

Error: Cannot find module '/tmp/build_92fbb8309064d6ceef570190a247df2b/webpack/webpack.config.js'

Вот полная ошибка:

remote: -----> Build
remote:        Running heroku-postbuild (yarn)
remote:        yarn run v1.22.4
remote:        $ npm run webpack:deploy
remote:        
remote:        > rails-frontend@ webpack:deploy /tmp/build_92fbb8309064d6ceef570190a247df2b
remote:        > webpack --config=webpack/webpack.config.js -p
remote:        
remote: /tmp/build_92fbb8309064d6ceef570190a247df2b/node_modules/webpack-cli/bin/cli.js:93
remote:                 throw err;
remote:                 ^
remote: 
remote: Error: Cannot find module '/tmp/build_92fbb8309064d6ceef570190a247df2b/webpack/webpack.config.js'
remote: Require stack:
remote: - /tmp/build_92fbb8309064d6ceef570190a247df2b/node_modules/webpack-cli/bin/utils/convert-argv.js
remote: - /tmp/build_92fbb8309064d6ceef570190a247df2b/node_modules/webpack-cli/bin/cli.js
remote: - /tmp/build_92fbb8309064d6ceef570190a247df2b/node_modules/webpack/bin/webpack.js
remote:     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:976:15)
remote:     at Function.Module._load (internal/modules/cjs/loader.js:859:27)
remote:     at Module.require (internal/modules/cjs/loader.js:1036:19)
remote:     at require (/tmp/build_92fbb8309064d6ceef570190a247df2b/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
remote:     at WEBPACK_OPTIONS (/tmp/build_92fbb8309064d6ceef570190a247df2b/node_modules/webpack-cli/bin/utils/convert-argv.js:114:13)
remote:     at requireConfig (/tmp/build_92fbb8309064d6ceef570190a247df2b/node_modules/webpack-cli/bin/utils/convert-argv.js:116:6)
remote:     at /tmp/build_92fbb8309064d6ceef570190a247df2b/node_modules/webpack-cli/bin/utils/convert-argv.js:123:17
remote:     at Array.forEach (<anonymous>)
remote:     at module.exports (/tmp/build_92fbb8309064d6ceef570190a247df2b/node_modules/webpack-cli/bin/utils/convert-argv.js:121:15)
remote:     at /tmp/build_92fbb8309064d6ceef570190a247df2b/node_modules/webpack-cli/bin/cli.js:71:45
remote:     at Object.parse (/tmp/build_92fbb8309064d6ceef570190a247df2b/node_modules/webpack-cli/node_modules/yargs/yargs.js:567:18)
remote:     at /tmp/build_92fbb8309064d6ceef570190a247df2b/node_modules/webpack-cli/bin/cli.js:49:8
remote:     at Object.<anonymous> (/tmp/build_92fbb8309064d6ceef570190a247df2b/node_modules/webpack-cli/bin/cli.js:366:3)
remote:     at Module._compile (internal/modules/cjs/loader.js:1147:30)
remote:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
remote:     at Module.load (internal/modules/cjs/loader.js:996:32)
remote:     at Function.Module._load (internal/modules/cjs/loader.js:896:14)
remote:     at Module.require (internal/modules/cjs/loader.js:1036:19)
remote:     at require (internal/modules/cjs/helpers.js:72:18)
remote:     at Object.<anonymous> (/tmp/build_92fbb8309064d6ceef570190a247df2b/node_modules/webpack/bin/webpack.js:156:2)
remote:     at Module._compile (internal/modules/cjs/loader.js:1147:30)
remote:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
remote:     at Module.load (internal/modules/cjs/loader.js:996:32)
remote:     at Function.Module._load (internal/modules/cjs/loader.js:896:14)
remote:     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
remote:     at internal/main/run_main_module.js:17:47 {
remote:   code: 'MODULE_NOT_FOUND',
remote:   requireStack: [
remote:     '/tmp/build_92fbb8309064d6ceef570190a247df2b/node_modules/webpack-cli/bin/utils/convert-argv.js',
remote:     '/tmp/build_92fbb8309064d6ceef570190a247df2b/node_modules/webpack-cli/bin/cli.js',
remote:     '/tmp/build_92fbb8309064d6ceef570190a247df2b/node_modules/webpack/bin/webpack.js'
remote:   ]
remote: }
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! rails-frontend@ webpack:deploy: `webpack --config=webpack/webpack.config.js -p`
remote: npm ERR! Exit status 1
remote: npm ERR! 
remote: npm ERR! Failed at the rails-frontend@ webpack:deploy script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote: 
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR!     /tmp/npmcache.fMcfX/_logs/2020-04-11T13_32_22_798Z-debug.log
remote: error Command failed with exit code 1.
remote:        info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
remote: 
remote: -----> Build failed
remote:        
remote:        We're sorry this build is failing! You can troubleshoot common issues here:
remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:        
remote:        If you're stuck, please submit a ticket so we can help:
remote:        https://help.heroku.com/
remote:        
remote:        Love,
remote:        Heroku
remote:        
remote:  !     Push rejected, failed to compile Node.js app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to brandon-olin-portfolio.
remote: 
To https://git.heroku.com/brandon-olin-portfolio.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/brandon-olin-portfolio.git'

Я попытался решить эту проблему с помощью различных других предложений стекового потока и сделал изменяет пакет. json файл соответственно:

{
  "name": "rails-frontend",
  "private": true,
  "dependencies": {
    "@rails/webpacker": "5.0.1",
    "bootstrap": "^4.4.1",
    "jquery": "^3.4.1",
    "popper.js": "^1.16.1",
    "typed.js": "^2.0.11"
  },
  "devDependencies": {
    "webpack-dev-server": "^3.10.3"
  },
  "scripts": {
    "webpack:deploy": "webpack --config=webpack/webpack.config.js -p",
    "heroku-postbuild": "npm run webpack:deploy",
    "start": "node your-script.js"
  },
  "engines": {
    "node": "13.12.0",
    "npm": "6.14.4"
  }
}

Я также пытался использовать этот сборочный пакет: https://github.com/febeling/webpack-rails-buildpack

и другие различные способы устранения неполадок, но я все еще не могу заставить его работать. Я, наверное, упускаю что-то очевидное здесь, но я не могу понять это для моей жизни. Цени любое понимание!

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...