Rails 在 capistrano 中预编译资产时找不到 6.1 命令 webpack
Rails 6.1 command webpack not found when precompiling assets in capistrano
我有一个 capistrano/sshkit rake assets:precompile 生成命令 webpack 的问题,当我的 capistrano apply_theme 任务被调用时
我已将 bin 文件夹签入源代码管理,我有节点版本 v12.18.1 和纱线版本 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...
这在从 rails 6.0.3.2 更新到 6.1 alpha
之前一直有效
以下当运行直接在服务器上工作
RAILS_ENV="production" bundle exec rake assets:precompile
并生成
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/
然而,当从我的开发箱 运行ning cap production deploy
时,我收到错误命令 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.
运行以下命令:
yarn add webpack
这应该可以解决问题
找到解决方案 here(感谢 Michael 将它放在那里)。
问题与“webpack”依赖项无关,您只需要在 bin
文件夹中有一个 binstub
创建一个名为 yarn
的文件并添加这些行。
#!/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
然后让它可执行。切换到bin文件夹,在控制台输入这个
chmod +x yarn
这对我有用!
我在这方面遇到了困难。但是 解决了:
- 添加节点构建包
heroku buildpacks:add --index 1 heroku/nodejs
- 确保你没有使用 太 最新版本的 webpack,因为即使是最新版本的 webpacker 也不兼容它:
Rails' webpacker 5.x.x is only compatible with webpack 4.x.x (https://github.com/rails/webpacker/tree/5-x-stable). You might want to downgrade to webpack 4 :)
我用 yarn add webpack@4.46.0
安装了最新的 4.x.x 版本。
我有一个 capistrano/sshkit rake assets:precompile 生成命令 webpack 的问题,当我的 capistrano apply_theme 任务被调用时
我已将 bin 文件夹签入源代码管理,我有节点版本 v12.18.1 和纱线版本 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...
这在从 rails 6.0.3.2 更新到 6.1 alpha
之前一直有效以下当运行直接在服务器上工作
RAILS_ENV="production" bundle exec rake assets:precompile
并生成
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/
然而,当从我的开发箱 运行ning cap production deploy
时,我收到错误命令 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.
运行以下命令:
yarn add webpack
这应该可以解决问题
找到解决方案 here(感谢 Michael 将它放在那里)。
问题与“webpack”依赖项无关,您只需要在 bin
文件夹中有一个 binstub
创建一个名为 yarn
的文件并添加这些行。
#!/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
然后让它可执行。切换到bin文件夹,在控制台输入这个
chmod +x yarn
这对我有用!
我在这方面遇到了困难。但是
- 添加节点构建包
heroku buildpacks:add --index 1 heroku/nodejs
- 确保你没有使用 太 最新版本的 webpack,因为即使是最新版本的 webpacker 也不兼容它:
Rails' webpacker 5.x.x is only compatible with webpack 4.x.x (https://github.com/rails/webpacker/tree/5-x-stable). You might want to downgrade to webpack 4 :)
我用 yarn add webpack@4.46.0
安装了最新的 4.x.x 版本。