rh / lodash-rails

lodash for the Rails asset pipeline
MIT License
75 stars 10 forks source link

Sprockets::FileNotFound: couldn't find file 'lodash' with type 'application/javascript' #8

Open etagwerker opened 5 years ago

etagwerker commented 5 years ago

Hi there,

I followed the instructions in the README and I got this error:

$ bundle exec  rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke yarn:install (first_time)
** Execute yarn:install
** Execute assets:precompile
rake aborted!
Sprockets::FileNotFound: couldn't find file 'lodash' with type 'application/javascript'
Checked in these paths:
  /Users/etagwerker/Projects/foo/bar/components/call_queues/spec/dummy/app/assets/images
  /Users/etagwerker/Projects/foo/bar/components/call_queues/spec/dummy/app/assets/javascripts
  /Users/etagwerker/Projects/foo/bar/components/call_queues/spec/dummy/app/assets/stylesheets
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/bundler/gems/storybook-8fa63b41dd2b/app/assets/images
  /Users/etagwerker/Projects/foo/bar/components/call_queues/app/assets/javascripts
  /Users/etagwerker/Projects/foo/bar/components/contact_center/app/assets/config
  /Users/etagwerker/Projects/foo/bar/components/contact_center/app/assets/images
  /Users/etagwerker/Projects/foo/bar/components/contact_center/app/assets/javascripts
  /Users/etagwerker/Projects/foo/bar/components/contact_center/app/assets/stylesheets
  /Users/etagwerker/Projects/foo/bar/components/nct/app/assets/images
  /Users/etagwerker/Projects/foo/bar/components/nct/app/assets/javascripts
  /Users/etagwerker/Projects/foo/bar/components/nct/app/assets/stylesheets
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/strophejs-rails-1.1.1/vendor/assets/javascripts
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/select2-rails-3.5.9.1/vendor/assets/images
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/select2-rails-3.5.9.1/vendor/assets/javascripts
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/select2-rails-3.5.9.1/vendor/assets/stylesheets
  /Users/etagwerker/Projects/foo/bar/components/notif/app/assets/config
  /Users/etagwerker/Projects/foo/bar/components/notif/app/assets/images
  /Users/etagwerker/Projects/foo/bar/components/notif/app/assets/javascripts
  /Users/etagwerker/Projects/foo/bar/components/notif/app/assets/stylesheets
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/jquery_context_menu-rails-0.0.4/vendor/assets/images
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/jquery_context_menu-rails-0.0.4/vendor/assets/javascripts
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/jquery_context_menu-rails-0.0.4/vendor/assets/stylesheets
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/jquery-fileupload-rails-0.4.7/app/assets/images
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/jquery-fileupload-rails-0.4.7/app/assets/javascripts
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/jquery-fileupload-rails-0.4.7/app/assets/stylesheets
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/jquery-datatables-rails-3.4.0/app/assets/images
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/jquery-datatables-rails-3.4.0/app/assets/javascripts
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/jquery-datatables-rails-3.4.0/app/assets/media
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/jquery-datatables-rails-3.4.0/app/assets/stylesheets
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/coffee-rails-4.2.2/lib/assets/javascripts
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/bootstrap-editable-rails-0.0.9/app/assets/images
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/bootstrap-editable-rails-0.0.9/app/assets/javascripts
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/bootstrap-editable-rails-0.0.9/app/assets/stylesheets
  /Users/etagwerker/Projects/foo/bar/components/core_models/app/assets/fonts
  /Users/etagwerker/Projects/foo/bar/components/core_models/app/assets/images
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/zeroclipboard-rails-0.1.2/app/assets/images
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/zeroclipboard-rails-0.1.2/app/assets/javascripts
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/twitter-typeahead-rails-0.10.5/vendor/assets/javascripts
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sweet-alert-confirm-0.4.1/lib/assets/javascripts
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sweet-alert-confirm-0.4.1/lib/assets/stylesheets
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/remotipart-1.3.1/vendor/assets/javascripts
  /Users/etagwerker/Projects/foo/bar/components/phone_metadata/app/assets/config
  /Users/etagwerker/Projects/foo/bar/components/phone_metadata/app/assets/images
  /Users/etagwerker/Projects/foo/bar/components/phone_metadata/app/assets/javascripts
  /Users/etagwerker/Projects/foo/bar/components/phone_metadata/app/assets/stylesheets
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/ckeditor-4.2.4/app/assets/images
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/ckeditor-4.2.4/app/assets/javascripts
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/ckeditor-4.2.4/app/assets/stylesheets
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/ckeditor-4.2.4/vendor/assets/javascripts
  /Users/etagwerker/Projects/foo/bar/components/search/app/assets/javascripts
  /Users/etagwerker/Projects/foo/bar/components/search/app/assets/stylesheets
  /Users/etagwerker/Projects/foo/bar/components/pubsub/app/assets/javascripts
  /Users/etagwerker/Projects/foo/bar/components/pubsub/app/assets/stylesheets
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/message_bus-2.2.1/vendor/assets/javascripts
  /Users/etagwerker/Projects/foo/bar/components/theme/app/assets/images
  /Users/etagwerker/Projects/foo/bar/components/theme/app/assets/javascripts
  /Users/etagwerker/Projects/foo/bar/components/theme/app/assets/stylesheets
  /Users/etagwerker/Projects/foo/bar/components/theme/vendor/assets/javascripts
  /Users/etagwerker/Projects/foo/bar/components/theme/vendor/assets/stylesheets
  /Users/etagwerker/Projects/foo/bar/components/react/app/assets/stylesheets
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/jquery-rails-4.3.1/vendor/assets/javascripts
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/actionview-5.1.6.2/lib/assets/compiled
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/turbolinks-source-5.2.0/lib/assets/javascripts
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/bundler/gems/storybook-8fa63b41dd2b/fonts
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/bootstrap-sass-3.3.5.1/assets/stylesheets
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/bootstrap-sass-3.3.5.1/assets/javascripts
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/bootstrap-sass-3.3.5.1/assets/fonts
  /Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/bootstrap-sass-3.3.5.1/assets/images
/Users/etagwerker/Projects/foo/bar/components/call_queues/app/assets/javascripts/call_queues/application.js:13
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/resolve.rb:65:in `resolve!'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:399:in `resolve'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:207:in `process_require_directive'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:180:in `block in process_directives'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:178:in `each'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:178:in `process_directives'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:83:in `_call'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/directive_processor.rb:68:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/bundle.rb:23:in `block in call'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/utils.rb:200:in `dfs'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/bundle.rb:24:in `call'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:66:in `find_asset'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:142:in `block in find'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:228:in `block in stat_tree'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `each'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `stat_directory'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:227:in `stat_tree'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:231:in `block in stat_tree'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `each'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `stat_directory'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:227:in `stat_tree'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `each'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `block in logical_paths'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `each'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `logical_paths'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:140:in `find'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:186:in `compile'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-rails-2.3.3/lib/sprockets/rails/task.rb:70:in `block (3 levels) in define'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-3.7.2/lib/rake/sprocketstask.rb:147:in `with_logger'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/sprockets-rails-2.3.3/lib/sprockets/rails/task.rb:69:in `block (2 levels) in define'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/newrelic-rake-1.4.1/lib/newrelic-rake/instrument.rb:33:in `block in execute_with_newrelic_trace'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/newrelic_rpm-5.6.0.349/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:370:in `perform_action_with_newrelic_trace'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/newrelic-rake-1.4.1/lib/newrelic-rake/instrument.rb:32:in `execute_with_newrelic_trace'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/newrelic-rake-1.4.1/lib/newrelic-rake/instrument.rb:23:in `execute'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/Users/etagwerker/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/rake-10.5.0/lib/rake/application.rb:150:in `invoke_task'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `each'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `block in top_level'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/rake-10.5.0/lib/rake/application.rb:115:in `run_with_threads'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/rake-10.5.0/lib/rake/application.rb:100:in `top_level'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/rake-10.5.0/lib/rake/application.rb:78:in `block in run'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/rake-10.5.0/lib/rake/application.rb:75:in `run'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/gems/rake-10.5.0/bin/rake:33:in `<top (required)>'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/bin/rake:23:in `load'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/bin/rake:23:in `<main>'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:24:in `eval'
/Users/etagwerker/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:24:in `<main>'
Tasks: TOP => assets:precompile

I'm trying to use this gem from within a Rails engine. So I'm trying to run rake assets:precompile inside the spec/dummy directory.

I'm using Rails 5.1.6.2 and sprockets-rails 2.3.3.

Do you know what could be going on here?

Thank you!

etagwerker commented 5 years ago

FWIW, adding this to my main engine file solves this problem:

require "lodash/rails"
laynejohnson commented 3 years ago

Hi @etagwerker ! I am having a similar problem when pushing to a staging environment on Heroku. What file did you add require "lodash/rails" to to solve this? (I'm sorry, new developer :) )

etagwerker commented 3 years ago

@laynejohnson I think if you can add it to one of the files in your config directory it "should work"

You could try adding it to a file in the config/initializers/ directory or directly into config/application.rb -- I hope that solves it for you

laynejohnson commented 3 years ago

@etagwerker Thank you so much!