I'm working on a rails app that uses webpack and babel to handle the JavaScript I've incorporated and every time I try to deploy to heroku I get this error "Error: Cannot find module '@rails/webpacker'". I've verified that webpacker is installed and included in my Gemfile
and have even tried updating. I'm not sure what else could be wrong and I wasn't able to find a fix on here or in the heroku troubleshooting. Here's what the error looks like:
remote: Webpacker is installed 🎉 🍰
remote: Using /tmp/build_8b49575f969275dcaa6d475e06d48642/config/webpacker.yml file for setting up webpack paths
remote: Compiling…
remote: Compilation failed:
remote: module.js:540
remote: throw err;
remote: ^
remote: Error: Cannot find module '@rails/webpacker'
remote: at Function.Module._resolveFilename (module.js:538:15)
remote: at Function.Module._load (module.js:468:25)
remote: at Module.require (module.js:587:17)
remote: at require (internal/module.js:11:18)
remote: at Object.<anonymous> (/tmp/build_8b49575f969275dcaa6d475e06d48642/config/webpack/environment.js:1:87)
remote: at Module._compile (module.js:643:30)
remote: at Object.Module._extensions..js (module.js:654:10)
remote: at Module.load (module.js:556:32)
remote: at tryModuleLoad (module.js:499:12)
remote: at Function.Module._load (module.js:491:3)
remote: !
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to guarded-falls-58657.
remote:
To https://git.heroku.com/guarded-falls-58657.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/guarded-falls-
58657.git'
Would you try this?
heroku buildpacks:clear
heroku buildpacks:set heroku/nodejs
heroku buildpacks:add heroku/ruby
https://github.com/rails/webpacker/issues/739#issuecomment-327546884
It seems that the Ruby default buildpack has some outdated node-related engines. Should be fixed soon hopefully.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.