Rails 5.1
webpacker 2.0
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: I, [2017-09-16T16:04:39.352408 #999] INFO -- : Writing /tmp/build_aa92d35014f89ac8321226fb525fef29/public/assets/application-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.js
remote: I, [2017-09-16T16:04:39.352916 #999] INFO -- : Writing /tmp/build_aa92d35014f89ac8321226fb525fef29/public/assets/application-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.js.gz
remote: I, [2017-09-16T16:04:53.595559 #999] INFO -- : Writing /tmp/build_aa92d35014f89ac8321226fb525fef29/public/assets/application-f89040623de291aef622c68afd0757f7887e600a25e25cf3542ad9ff7d797a6e.css
remote: I, [2017-09-16T16:04:53.595736 #999] INFO -- : Writing /tmp/build_aa92d35014f89ac8321226fb525fef29/public/assets/application-f89040623de291aef622c68afd0757f7887e600a25e25cf3542ad9ff7d797a6e.css.gz
remote: Webpacker is installed 🎉 🍰
remote: Using /tmp/build_aa92d35014f89ac8321226fb525fef29/config/webpacker.yml file for setting up webpack paths
remote: [Webpacker] Compiling assets 🎉
remote: error Command failed with exit code 2.
remote:
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 ezpoisk.
remote:
To ssh://heroku.com/ezpoisk.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'ssh://[email protected]/ezpoisk.git'
Did you see this similar issue #530 ?
@curvo I did, but I couldn't make anything out of it. Also, I don't us ts.
I tried to run locally
bundle exec rake ASSET_HOST=drex16ydhdd8s.cloudfront.net NODE_ENV=production RAILS_ENV=production assets:precompile --trace
and it went ok.
I also tried with webpack update to 3.0 and to master.... and result always the same.
@AndreiMotinga comparing that to my deployment logs, right below the line where it says
remote: Running: rake assets:precompile
my logs follow with
yarn install v1.0.2
Can you verify that:
node and ruby buildpacks set up with your Heroku app (in that order)package.json (if you're using Webpacker 3, otherwise Heroku will default to 0.22.0) "engines": {
"node": ">=6.0.0",
"yarn": ">=0.25.2"
}
@janklimo, thank you for the comment.
After adding it, here's the log
Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.0.pre.2). We suggest you upgrade to the latest version of Bundler by running `gem install bundler --pre`.
remote: Removing gmaps4rails (2.1.2)
remote: Removing webpacker (2.0)
remote: The latest bundler is 1.16.0.pre.2, but you are currently running 1.15.2.
remote: To update, run `gem install bundler --pre`
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: I, [2017-09-17T13:50:21.460080 #1063] INFO -- : Writing /tmp/build_85f3cc087430b06796ea9b4c27112a56/public/assets/application-f89040623de291aef622c68afd0757f7887e600a25e25cf3542ad9ff7d797a6e.css
remote: I, [2017-09-17T13:50:21.460614 #1063] INFO -- : Writing /tmp/build_85f3cc087430b06796ea9b4c27112a56/public/assets/application-f89040623de291aef622c68afd0757f7887e600a25e25cf3542ad9ff7d797a6e.css.gz
remote: Webpacker is installed 🎉 🍰
remote: Using /tmp/build_85f3cc087430b06796ea9b4c27112a56/config/webpacker.yml file for setting up webpack paths
remote: Compiling…
remote: Compilation failed:
remote: yarn run v1.0.2
remote: $ "/tmp/build_85f3cc087430b06796ea9b4c27112a56/node_modules/.bin/webpack" "--config" "/tmp/build_85f3cc087430b06796ea9b4c27112a56/config/webpack/production.js"
remote: Hash: 6b4dd7508f664a1f18fd
remote: Version: webpack 3.5.4
remote: Time: 16369ms
remote: Asset Size Chunks Chunk Names
remote: bundle-5601ab3ed98fc4a0afbf.js 559 kB 0 [emitted] [big] bundle
remote: dropzone-62ebbae5278ba83b75a2.js 95.1 kB 1 [emitted] dropzone
remote: bundle-5601ab3ed98fc4a0afbf.js.map 3.61 MB 0 [emitted] bundle
remote: dropzone-62ebbae5278ba83b75a2.js.map 799 kB 1 [emitted] dropzone
remote: dropzone-62ebbae5278ba83b75a2.js.gz 31.8 kB [emitted]
remote: bundle-5601ab3ed98fc4a0afbf.js.gz 168 kB [emitted]
remote: manifest.json 370 bytes [emitted]
remote: [98] ./app/javascript/packs/bundle.js 1.14 kB {0} [built]
remote: [126] ./app/javascript/vendor/touchTouch.js 6.08 kB {0} [built]
remote: [132] ./app/javascript/old/listings/copy.js 550 bytes {0} [built]
remote: [133] ./app/javascript/old/listings/form.js 685 bytes {0} [built]
remote: [134] ./app/javascript/old/listings/search.js 126 bytes {0} [built]
remote: [135] ./app/javascript/old/questions/search.js 1.16 kB {0} [built]
remote: [136] ./app/javascript/old/bootstrap_init.js 61 bytes {0} [built]
remote: [137] ./app/javascript/old/comments.js 1.76 kB {0} [built]
remote: [138] ./app/javascript/old/pagination.js 556 bytes {0} [built]
remote: [139] ./app/javascript/old/partners.js 296 bytes {0} [built]
remote: [140] ./app/javascript/old/scroll_up.js 283 bytes {0} [built]
remote: [141] ./app/javascript/old/search_form.js 94 bytes {0} [built]
remote: [142] ./app/javascript/old/search_highlight.js 500 bytes {0} [built]
remote: [143] ./app/javascript/old/update_cities.js 508 bytes {0} [built]
remote: [144] ./app/javascript/packs/dropzone.js 478 bytes {1} [built]
remote: + 130 hidden modules
remote: WARNING in bundle-5601ab3ed98fc4a0afbf.js from UglifyJs
remote: Condition always true [./node_modules/jquery-ui/ui/version.js:2,0]
remote: Dropping unreachable code [./node_modules/jquery-ui/ui/version.js:9,0]
remote: Condition always true [./node_modules/jquery/external/sizzle/dist/sizzle.js:2133,0]
remote: Dropping unreachable code [./node_modules/jquery/external/sizzle/dist/sizzle.js:2136,1]
remote: Condition always true [./node_modules/jquery/src/exports/amd.js:18,0]
remote: Condition always true [./node_modules/jquery-ui/ui/keycode.js:16,0]
remote: Dropping unreachable code [./node_modules/jquery-ui/ui/keycode.js:23,0]
remote: Condition always true [./node_modules/jquery-ui/ui/position.js:19,0]
remote: Dropping unreachable code [./node_modules/jquery-ui/ui/position.js:26,0]
remote: Condition always true [./node_modules/jquery-ui/ui/safe-active-element.js:2,0]
remote: Dropping unreachable code [./node_modules/jquery-ui/ui/safe-active-element.js:9,0]
remote: Condition always true [./node_modules/jquery-ui/ui/widget.js:17,0]
remote: Dropping unreachable code [./node_modules/jquery-ui/ui/widget.js:24,0]
remote: Condition always true [./node_modules/codemirror/lib/codemirror.js:11,0]
remote: Non-strict equality against boolean: == false [./node_modules/codemirror/lib/codemirror.js:1299,0]
remote: Side effects in initialization of unused variable __WEBPACK_IMPORTED_MODULE_30_old_update_cities___default [./app/javascript/packs/bundle.js:1,0]
remote: Condition always true [./node_modules/jquery-ui/ui/widgets/autocomplete.js:20,0]
remote: Dropping unreachable code [./node_modules/jquery-ui/ui/widgets/autocomplete.js:35,0]
remote: Condition always true [./node_modules/jquery-ui/ui/widgets/menu.js:20,0]
remote: Dropping unreachable code [./node_modules/jquery-ui/ui/widgets/menu.js:35,0]
remote: Condition always true [./node_modules/jquery-ui/ui/unique-id.js:16,0]
remote: Dropping unreachable code [./node_modules/jquery-ui/ui/unique-id.js:23,0]
remote: Condition always true [./node_modules/jquery-ui/ui/widgets/datepicker.js:22,0]
remote: Dropping unreachable code [./node_modules/jquery-ui/ui/widgets/datepicker.js:33,0]
remote: Condition always true [./node_modules/select2/dist/js/select2.js:9,0]
remote: Dropping unreachable code [./node_modules/select2/dist/js/select2.js:12,3]
remote: Side effects in initialization of unused variable $label [./node_modules/select2/dist/js/select2.js:972,0]
remote: Side effects in initialization of unused variable id [./node_modules/select2/dist/js/select2.js:1350,0]
remote: Dropping unused variable self [./node_modules/select2/dist/js/select2.js:1426,0]
remote: Dropping unused variable matches [./node_modules/select2/dist/js/select2.js:3430,0]
remote: Side effects in initialization of unused variable tag [./node_modules/select2/dist/js/select2.js:3608,0]
remote: Side effects in initialization of unused variable instance [./node_modules/select2/dist/js/select2.js:5667,0]
remote: Condition always true [./node_modules/timeago/jquery.timeago.js:18,0]
remote: Dropping unreachable code [./node_modules/timeago/jquery.timeago.js:21,3]
remote: Condition always true [./node_modules/jquery-sticky/jquery.sticky.js:14,0]
remote: Dropping unreachable code [./node_modules/jquery-sticky/jquery.sticky.js:17,5]
remote: Condition always true [./node_modules/summernote-webpack/dist/summernote.js:13,0]
remote: Dropping unreachable code [./node_modules/summernote-webpack/dist/summernote.js:16,3]
remote: Condition left of && always true [./node_modules/summernote-webpack/dist/summernote.js:355,0]
remote: Dropping side-effect-free statement [./node_modules/summernote-webpack/dist/summernote.js:401,0]
remote: Side effects in initialization of unused variable dummy [./node_modules/summernote-webpack/dist/summernote.js:2293,0]
remote: Non-strict equality against boolean: == false [./app/javascript/vendor/pgwslider.js:657,52]
remote: Non-strict equality against boolean: == false [./app/javascript/vendor/pgwslider.js:658,44]
remote: Side effects in initialization of unused variable desc [./app/javascript/old/components/partner.js:28,8]
remote: WARNING in dropzone-62ebbae5278ba83b75a2.js from UglifyJs
remote: Condition always true [./node_modules/jquery/external/sizzle/dist/sizzle.js:2133,0]
remote: Dropping unreachable code [./node_modules/jquery/external/sizzle/dist/sizzle.js:2136,1]
remote: Condition always true [./node_modules/jquery/src/exports/amd.js:18,0]
remote: Dropping unreachable code [./app/javascript/packs/dropzone.js:4,0]
remote: Dropping unreachable code [./app/javascript/packs/dropzone.js:6,0]
remote: Declarations in unreachable code! [./app/javascript/packs/dropzone.js:6,0]
remote: Dropping unreachable code [./app/javascript/packs/dropzone.js:13,0]
remote: Declarations in unreachable code! [./app/javascript/packs/dropzone.js:13,0]
remote: Dropping unreachable code [./app/javascript/packs/dropzone.js:14,0]
remote: ERROR in ./app/javascript/packs/dropzone.js
remote: Module not found: Error: Can't resolve 'Dropzone' in '/tmp/build_85f3cc087430b06796ea9b4c27112a56/app/javascript/packs'
remote: @ ./app/javascript/packs/dropzone.js 1:0-32
remote: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
remote: warning package.json: No license field
remote: warning From Yarn 1.0 onwards, scripts don't require "--" for options to be forwarded. In a future version, any explicit "--" will be forwarded as-is to the scripts.
remote: error Command failed with exit code 2.
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 ezpoisk.
remote:
To ssh://heroku.com/ezpoisk.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'ssh://[email protected]/ezpoisk.git'
...
in /app/javascript/packs/dropzone.js replaced
import Dropzone from "Dropzone" with import Dropzone from "dropzone"
and all went well.
Once again, I appreciate the help.
@AndreiMotinga Did you mean to close this? I am confused by your logs... did @janklimo's suggestions help you?
@curvo I did.
logs pointed me to the issue. as I mentioned
in /app/javascript/packs/dropzone.js replaced
import Dropzone from "Dropzone" with import Dropzone from "dropzone"
So I fixed it and deployed.
It's a bit odd since I was able to compile locally using production env variables, but still.
@AndreiMotinga Interesting. Sounds like the newer yarn version gave you a more descriptive log that pointed you to the root of the issue?
@janklimo
I'm not really sure, I guess you're right. All I know is, it was failing without any logs even with warnings: true in production.js, even though was compiling fine locally.
And when I added
"engines": {
"node": ">=6.0.0",
"yarn": ">=0.25.2"
}
as you suggested, it gave me a log to go of. So... yeah, I guess, that's right. Thanks again.
As to the root of the 'bug', why didn't it fail properly from the start - I don't know.
I came across the same issue, after specifying the engines values I continued to get issues. I wanted to clarify @janklimo comment about the buildpacks.
You must have heroku/nodejs before heroku/ruby since the engines key is not supported in the ruby buildpack.
Your app.json should look something like:
{
"buildpacks": [
{ "url": "heroku/nodejs" },
{ "url": "heroku/ruby" }
]
}
I had the same issue with vue. Using buildpack nodejs and then ruby (in that order) fixed the problem. Thank you @janklimo
@AnwarShah Does adding both buildpacks duplicates yarn install command in your deploy? https://github.com/rails/webpacker/issues/405
Most helpful comment
@AndreiMotinga comparing that to my deployment logs, right below the line where it says
my logs follow with
Can you verify that:
nodeandrubybuildpacks set up with your Heroku app (in that order)package.json(if you're using Webpacker 3, otherwise Heroku will default to0.22.0)