question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`javascript_dir': undefined method `source_path' for Webpacker::Configuration:Class (NoMethodError)

See original GitHub issue

I am trying to install ‘react-rails’ with ‘webpacker’. I added both this gems in my rails gemfile. Versions for ruby, rails & gems are as follows:-

  1. Ruby: 2.4.1
  2. Rails: 5.1
  3. react-rails gem: 2.2.1
  4. webpacker: 3.0.0

I am not able to run “rails generate react:install” command to generate components/ directory for my React components.

I found that there was an issue in react-rails-2.2.1/lib/generators/react/install_generator.rb file for javascript_dir method.

Earlier code:- def javascript_dir if webpacker? Webpacker::Configuration.source_path .join(Webpacker::Configuration.entry_path) .relative_path_from(::Rails.root) .to_s else 'app/assets/javascripts' end end

Code to fix: def javascript_dir if webpacker? Webpacker.config.source_path .join(Webpacker.config.source_entry_path) .relative_path_from(::Rails.root) .to_s else 'app/assets/javascripts' end end

The term Webpacker::Configuration is chnaged to Webpacker.config and method name entry_path is changed to source_entry_path.

This work for me…!! Hope this works for you guys!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:9
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
thealexauercommented, Sep 20, 2017

Had the same issue, the current master branch fixed it.

2reactions
benaubincommented, Sep 2, 2017

The fix you suggested worked for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upgrading from 2.0.0 to 3.0.2 breaks configuration · Issue #966
It appears that #636 changed the API for accessing Webpacker's configuration. We previously found the source path via Webpacker::Configuration.
Read more >
NoMethodError: undefined method `+' for nil:NilClass ...
In your config/webpacker.yml, resolved_paths has been deprecated and should be replaced by additional_paths ...
Read more >
Webpacker - Ruby on Rails Guides
This guide will show you how to install and use Webpacker to package JavaScript, CSS, and other assets for the client-side of your...
Read more >
Importing images with Webpacker - rossta.net
First, where should you put your images? It doesn't matter. The easiest place to start is under your app/javascript folder, the default source...
Read more >
NoMethodError: undefined method… (Example) - Treehouse
I'm using Rspec 3.2.3 but can't find a rails_helper.rb file. I put the updated configuration in the spec_helper.rb file and everything is ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found