【发布时间】:2018-02-09 02:23:29
【问题描述】:
我正在开发一个使用 webpack 和 babel 来处理我已合并的 JavaScript 的 rails 应用程序,每次我尝试部署到 heroku 时都会收到此错误“错误:找不到模块 '@rails/webpacker'” .我已验证 webpacker 已安装并包含在我的Gemfile 中,甚至尝试过更新。我不确定还有什么问题,我无法在此处或 heroku 故障排除中找到解决方法。以下是错误的样子:
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'
【问题讨论】:
-
您在 Heroku 上使用了哪些构建包?我依稀记得我必须添加
heroku/nodejs才能使其工作。但我在这里可能完全错了...... -
我同时使用了 ruby 和 nodejs buildpacks
标签: ruby-on-rails ruby heroku webpack