I have a capistrano/sshkit problem with rake assets:precompile generating command webpack not found when my capistrano apply_theme task is invoked
I have the bin folder checked into source control and I have node version v12.18.1 and yarn version 1.22.4
set :rvm_map_bins, [ 'rake', 'gem', 'bundle', 'ruby', 'puma', 'pumactl', 'webpack' ]
namespace :deploy do
desc 'Updating theme'
task apply_theme: [:set_rails_env] do
on roles(:app) do
within release_path do
with rails_env: fetch(:rails_env) do
execute :rake, 'write_css'
execute :rake, 'assets:precompile'
end
end
end
end
#etc...
This has worked previously prior to updating from rails 6.0.3.2 to 6.1 alpha
The following when run directly on the server works
RAILS_ENV="production" bundle exec rake assets:precompile
and generates
Compiling...
Compiled all packs in /home/comtechrcc/rawdoncc/releases/20200629090644/public/packs
Hash: b1c4524d882fd4ab2775
Version: webpack 4.43.0
Time: 6696ms
Built at: 06/30/2020 3:07:43 PM
Asset Size Chunks Chunk Names
js/application-e8c232440ca35fbfc7ed.js 164 KiB 0 [emitted] [immutable] application
js/application-e8c232440ca35fbfc7ed.js.LICENSE.txt 497 bytes [emitted]
js/application-e8c232440ca35fbfc7ed.js.br 44.3 KiB [emitted]
js/application-e8c232440ca35fbfc7ed.js.gz 50.1 KiB [emitted]
js/application-e8c232440ca35fbfc7ed.js.map 674 KiB 0 [emitted] [dev] application
js/application-e8c232440ca35fbfc7ed.js.map.br 164 KiB [emitted]
js/application-e8c232440ca35fbfc7ed.js.map.gz 192 KiB [emitted]
js/consent-3541241bff4d08d2cdc8.js 1.74 KiB 1 [emitted] [immutable] consent
js/consent-3541241bff4d08d2cdc8.js.br 779 bytes [emitted]
js/consent-3541241bff4d08d2cdc8.js.gz 951 bytes [emitted]
js/consent-3541241bff4d08d2cdc8.js.map 6.12 KiB 1 [emitted] [dev] consent
js/consent-3541241bff4d08d2cdc8.js.map.br 2.12 KiB [emitted]
js/consent-3541241bff4d08d2cdc8.js.map.gz 2.45 KiB [emitted]
js/jscolor-fbb513be09d718775c40.js 29.1 KiB 2 [emitted] [immutable] jscolor
js/jscolor-fbb513be09d718775c40.js.LICENSE.txt 276 bytes [emitted]
js/jscolor-fbb513be09d718775c40.js.br 7.27 KiB [emitted]
js/jscolor-fbb513be09d718775c40.js.gz 8.19 KiB [emitted]
js/jscolor-fbb513be09d718775c40.js.map 102 KiB 2 [emitted] [dev] jscolor
js/jscolor-fbb513be09d718775c40.js.map.br 23.1 KiB [emitted]
js/jscolor-fbb513be09d718775c40.js.map.gz 26.9 KiB [emitted]
js/sortable-35a5ae5fe10b2c580832.js 395 KiB 3 [emitted] [immutable] [big] sortable
js/sortable-35a5ae5fe10b2c580832.js.LICENSE.txt 5.18 KiB [emitted]
js/sortable-35a5ae5fe10b2c580832.js.br 94.7 KiB [emitted]
js/sortable-35a5ae5fe10b2c580832.js.gz 111 KiB [emitted]
js/sortable-35a5ae5fe10b2c580832.js.map 1.52 MiB 3 [emitted] [dev] sortable
js/sortable-35a5ae5fe10b2c580832.js.map.br 344 KiB [emitted] [big]
js/sortable-35a5ae5fe10b2c580832.js.map.gz 415 KiB [emitted] [big]
js/transition-819672c9d2985c533475.js 17.8 KiB 4 [emitted] [immutable] transition
js/transition-819672c9d2985c533475.js.br 4.21 KiB [emitted]
js/transition-819672c9d2985c533475.js.gz 4.73 KiB [emitted]
js/transition-819672c9d2985c533475.js.map 61.6 KiB 4 [emitted] [dev] transition
js/transition-819672c9d2985c533475.js.map.br 14.3 KiB [emitted]
js/transition-819672c9d2985c533475.js.map.gz 16.2 KiB [emitted]
manifest.json 1.6 KiB [emitted]
manifest.json.br 289 bytes [emitted]
manifest.json.gz 335 bytes [emitted]
Entrypoint application = js/application-e8c232440ca35fbfc7ed.js js/application-e8c232440ca35fbfc7ed.js.map
Entrypoint consent = js/consent-3541241bff4d08d2cdc8.js js/consent-3541241bff4d08d2cdc8.js.map
Entrypoint jscolor = js/jscolor-fbb513be09d718775c40.js js/jscolor-fbb513be09d718775c40.js.map
Entrypoint sortable [big] = js/sortable-35a5ae5fe10b2c580832.js js/sortable-35a5ae5fe10b2c580832.js.map
Entrypoint transition = js/transition-819672c9d2985c533475.js js/transition-819672c9d2985c533475.js.map
[1] (webpack)/buildin/module.js 552 bytes {0} {3} [built]
[8] ./app/javascript/packs/application.js 790 bytes {0} [built]
[12] ./app/javascript/channels/index.js 205 bytes {0} [built]
[13] ./app/javascript/channels sync _channel\.js$ 160 bytes {0} [built]
[14] ./app/javascript/packs/consent.js 835 bytes {1} [built]
[15] ./app/javascript/packs/jscolor.js 42.7 KiB {2} [built]
[16] ./app/javascript/packs/sortable.js 1.35 KiB {3} [built]
[29] ./app/javascript/packs/transition.js 43 bytes {4} [built]
+ 42 hidden modules
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
js/sortable-35a5ae5fe10b2c580832.js (395 KiB)
js/sortable-35a5ae5fe10b2c580832.js.map.gz (415 KiB)
js/sortable-35a5ae5fe10b2c580832.js.map.br (344 KiB)
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
sortable (395 KiB)
js/sortable-35a5ae5fe10b2c580832.js
WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
However when running cap production deploy
from my dev box I get error command webpack not found
Tasks: TOP => deploy:publishing => deploy:apply_theme
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing on host 46.101.0.71: rake exit status: 1
rake stdout: I, [2020-07-01T03:47:22.236597 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/manifest-2f0ac84ec540eb753a59078be1e78cb9bb00e12a9a8d6d826039a818a0008610.js
I, [2020-07-01T03:47:22.237088 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/manifest-2f0ac84ec540eb753a59078be1e78cb9bb00e12a9a8d6d826039a818a0008610.js.gz
I, [2020-07-01T03:47:22.237444 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/favicon-f4118a1c7993795f1519263cb07b5a52f770bd479e7a3b7b34a208f42fafeb61.ico
I, [2020-07-01T03:47:22.237828 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/favicon-f4118a1c7993795f1519263cb07b5a52f770bd479e7a3b7b34a208f42fafeb61.ico.gz
I, [2020-07-01T03:47:22.241489 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/site_banner-033c28f13b6778452c5dd702a065af245ed31642327ce5b2280d9640cf089bf6.wbp
I, [2020-07-01T03:47:22.242715 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/_admin_form-95a7cf026326d501435d2fc694548a5b58d8647f9f0615c50518337467088212.css
I, [2020-07-01T03:47:22.243303 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/_admin_form-95a7cf026326d501435d2fc694548a5b58d8647f9f0615c50518337467088212.css.gz
I, [2020-07-01T03:47:22.243805 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/_colours-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
I, [2020-07-01T03:47:22.244406 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/_colours-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
I, [2020-07-01T03:47:22.244884 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/_desktop_menu-6e52e9314b9a7eaef17cad3136965fb213c3ec8fa8047cb7b3cfc37f7ea7ea89.css
I, [2020-07-01T03:47:22.245398 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/_desktop_menu-6e52e9314b9a7eaef17cad3136965fb213c3ec8fa8047cb7b3cfc37f7ea7ea89.css.gz
I, [2020-07-01T03:47:22.245968 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/_hamburger-33ded8e64b166a1bcc8737964605b5e46d831806b68dfc94c5140e7dfc68b425.css
I, [2020-07-01T03:47:22.246777 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/_hamburger-33ded8e64b166a1bcc8737964605b5e46d831806b68dfc94c5140e7dfc68b425.css.gz
I, [2020-07-01T03:47:22.247827 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/_transitions-8de27d1347ed98a4ca72069157aa301736c2d0500d69ac46e10f34585af52feb.css
I, [2020-07-01T03:47:22.248421 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/_transitions-8de27d1347ed98a4ca72069157aa301736c2d0500d69ac46e10f34585af52feb.css.gz
I, [2020-07-01T03:47:22.249046 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/admin-eaa1632cb988456192ab0be1d1bc4a46a9fa35645dbb20d3f7b603500dcfacf4.css
I, [2020-07-01T03:47:22.249989 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/admin-eaa1632cb988456192ab0be1d1bc4a46a9fa35645dbb20d3f7b603500dcfacf4.css.gz
I, [2020-07-01T03:47:22.250635 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/admin_menu-a1563e06176e5fb2d653672395ac99b0318adfb2258067d5383ec149e3863110.css
I, [2020-07-01T03:47:22.251841 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/admin_menu-a1563e06176e5fb2d653672395ac99b0318adfb2258067d5383ec149e3863110.css.gz
I, [2020-07-01T03:47:22.252193 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/application-6b209f68260d4aa8838da9700b91b9f025959195a3c0696822be06f3d8e6f009.css
I, [2020-07-01T03:47:22.252566 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/application-6b209f68260d4aa8838da9700b91b9f025959195a3c0696822be06f3d8e6f009.css.gz
I, [2020-07-01T03:47:22.253181 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/config_settings-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
I, [2020-07-01T03:47:22.254898 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/config_settings-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
I, [2020-07-01T03:47:22.255359 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/contact-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
I, [2020-07-01T03:47:22.256155 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/contact-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
I, [2020-07-01T03:47:22.256568 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/pages-9c1dbf39f3ef6ef34622882460a0f51f6eb58a6201713590b6a5190ae5b1274d.css
I, [2020-07-01T03:47:22.257460 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/pages-9c1dbf39f3ef6ef34622882460a0f51f6eb58a6201713590b6a5190ae5b1274d.css.gz
I, [2020-07-01T03:47:22.258114 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/public-c5142a4f07440ec9943b8844c852f347acb7efcb4e1c1e20f4bf779c64094957.css
I, [2020-07-01T03:47:22.258819 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/public-c5142a4f07440ec9943b8844c852f347acb7efcb4e1c1e20f4bf779c64094957.css.gz
I, [2020-07-01T03:47:22.259434 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/public_menu-8368c148d0882cf2768aa2622f8d0300dc746c8e3846301d0a5a4f422dfe0c60.css
I, [2020-07-01T03:47:22.260123 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/public_menu-8368c148d0882cf2768aa2622f8d0300dc746c8e3846301d0a5a4f422dfe0c60.css.gz
I, [2020-07-01T03:47:22.260809 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/scaffolds-8abf05aa587d598a9a5f19e75f4e131f166c0ce16b233bdc5e251a167ac0b1e1.css
I, [2020-07-01T03:47:22.261687 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/scaffolds-8abf05aa587d598a9a5f19e75f4e131f166c0ce16b233bdc5e251a167ac0b1e1.css.gz
I, [2020-07-01T03:47:22.262092 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/app-7c3c38da788947165eb5b3f5bbec4f13416145f32b2fcc8835e2718a332f537b.js
I, [2020-07-01T03:47:22.262438 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/app-7c3c38da788947165eb5b3f5bbec4f13416145f32b2fcc8835e2718a332f537b.js.gz
I, [2020-07-01T03:47:22.263908 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/new_ckeditor/classic/ckeditor-f35d4f83a73c0f0e7fb53ceaf4c0443d00eb0fc917b0cdd5ab8230635503131e.js
I, [2020-07-01T03:47:22.264229 #101477] INFO -- : Writing /home/comtechrcc/rawdoncc/releases/20200701034704/public/assets/new_ckeditor/classic/ckeditor-f35d4f83a73c0f0e7fb53ceaf4c0443d00eb0fc917b0cdd5ab8230635503131e.js.gz
Compiling...
Compilation failed:
yarn run v1.22.4
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command "webpack" not found.
run the following command:
yarn add webpack
this should fix the issue
Found the solution here (thx Michael for putting it out there).
The problem is not related to the "webpack" dependency, you just need a binstub in your bin
folder
Create a file purely called yarn
and add these lines.
#!/usr/bin/env ruby
APP_ROOT = File.expand_path('..', __dir__)
Dir.chdir(APP_ROOT) do
begin
exec "yarnpkg", *ARGV
rescue Errno::ENOENT
$stderr.puts "Yarn executable was not detected in the system."
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
exit 1
end
end
Then make it executable. Switch to the bin folder and enter this in the console
chmod +x yarn
That worked for me!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With