I'm a fan of Open Source and have a growing interest in serverless and edge computing. I'm not a big fan of spiders, but they're doing good work eating bugs. I also stream on Twitch.
I'm a fan of Open Source and have a growing interest in serverless and edge computing. I'm not a big fan of spiders, but they're doing good work eating bugs. I also stream on Twitch.
I'm a fan of Open Source and have a growing interest in serverless and edge computing. I'm not a big fan of spiders, but they're doing good work eating bugs. I also stream on Twitch.
@rhymes
, @ben
, I figured out why it wasn't working the other day because it wasn't working for me today either. This is probably obvious to seasoned Rails devs, but this wasn't obvious to a Rails newb like me. 🙃
I didn't realize that Sprockets checks to see if the image actually exists, i.e. 'rails.png'. This is why I was getting exit code 1 from the rails-erb-loader.
and sure enough, I got an error but with more details.
Traceback (most recent call last):
25: from bin/rails:4:in `<main>'
24: from /Users/yolo/.gem/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:291:in `require'
23: from /Users/yolo/.gem/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:257:in `load_dependency'
22: from /Users/yolo/.gem/gems/activesupport-5.2.4.1/lib/active_support/dependencies.rb:291:in `block in require'
21: from /Users/yolo/.gem/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
20: from /Users/yolo/.gem/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
19: from /Users/yolo/.gem/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
18: from /Users/yolo/.gem/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
17: from /Users/yolo/.gem/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
16: from /Users/yolo/.gem/gems/railties-5.2.4.1/lib/rails/commands.rb:18:in `<main>'
15: from /Users/yolo/.gem/gems/railties-5.2.4.1/lib/rails/command.rb:46:in `invoke'
14: from /Users/yolo/.gem/gems/railties-5.2.4.1/lib/rails/command/base.rb:69:in `perform'
13: from /Users/yolo/.gem/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
12: from /Users/yolo/.gem/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
11: from /Users/yolo/.gem/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
10: from /Users/yolo/.gem/gems/railties-5.2.4.1/lib/rails/commands/runner/runner_command.rb:38:in `perform'
9: from /Users/yolo/.gem/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
8: from /Users/yolo/.gem/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
7: from /Users/yolo/dev/dev.to/node_modules/rails-erb-loader/erb_transformer.rb:19:in `<main>'
6: from /Users/yolo/.rbenv/versions/2.6.5/lib/ruby/2.6.0/erb.rb:901:in `result'
5: from /Users/yolo/.rbenv/versions/2.6.5/lib/ruby/2.6.0/erb.rb:901:in `eval'
4: from (erb):8:in `<main>'
3: from /Users/yolo/.gem/gems/actionview-5.2.4.1/lib/action_view/helpers/asset_url_helper.rb:375:in `image_path'
2: from /Users/yolo/.gem/gems/cloudinary-1.13.2/lib/cloudinary/helper.rb:378:in `path_to_asset'
1: from /Users/yolo/.gem/gems/actionview-5.2.4.1/lib/action_view/helpers/asset_url_helper.rb:200:in `asset_path'
/Users/yolo/.gem/gems/sprockets-rails-3.2.1/lib/sprockets/rails/helper.rb:83:in `compute_asset_path': The asset "rails.png" is not present in the asset pipeline. (Sprockets::Rails::Helper::AssetNotFound)
Sprockets::Rails::Helper::AssetNotFound.
So TIL that Sprockets actually looks for the asset. It just isn't trying to create a URL for any random image.
Remember folks, always dig when things aren't working 😉
Native Android developer/Consultant for Appwise, I work on custom projects for clients.
PHP/JS (web) developer in my freetime. Trying to keep learning in an ever changing tech world.
What about this? github.com/rails/webpacker/blob/ma...
I tried this earlier today and it did not seem to work. Maybe I had something misconfigured. Will give it another go. Thanks @rhymes !
Oh snap! It works now. Must have been a case of not enough coffee. Thanks peeps!
May anyone who lands on this thread during a future search rejoice!
@rhymes , @ben , I figured out why it wasn't working the other day because it wasn't working for me today either. This is probably obvious to seasoned Rails devs, but this wasn't obvious to a Rails newb like me. 🙃
This is the sample code from the webpacker docs
I didn't realize that Sprockets checks to see if the image actually exists, i.e.
'rails.png'
. This is why I was getting exit code 1 from the rails-erb-loader.I discovered this by reading through one of the issues about exit code 1 for rails-erb-loader.
I followed the instructions from n-rodriguez to test it outside of the rails-erb-loader, so I ran
and sure enough, I got an error but with more details.
Sprockets::Rails::Helper::AssetNotFound
.So TIL that Sprockets actually looks for the asset. It just isn't trying to create a URL for any random image.
Remember folks, always dig when things aren't working 😉
You beat me to it 😉I was about to comment it but refreshed first and saw your comment.