0

I've setup a rails app all good, server runs fine etc, now I need to add React to it. I see the command

rails webpack:install:react

appears to be the way everyone recommends but when I run this I get the following error:

rails aborted!
Don't know how to build task 'webpacker:install:react' (See the list of available 
tasks with `rails --tasks`)
Did you mean?  webpacker:install

So I run webpacker:install, alls good then try with :react again and the same errors generated, I've got react added in the package.json file and react-rails in the gem file. I've also run bundled since adding these.

I cant find an answer anywhere so whatever you've got I'll take.

Thank you.

Jake Worth
  • 5,490
  • 1
  • 25
  • 35
SlugLord
  • 143
  • 1
  • 9

2 Answers2

0

Found the issue, the problem was that webpacker:install:react was removed from webpacker v6, moved to version 5.4.3 and the issues resolved. More info here: https://github.com/rails/webpacker/pull/2802/files#diff-8efe491b392a5a50e31b54660bbc0e7258e544e36d4e0b8a65e4cca93d39d18c

SlugLord
  • 143
  • 1
  • 9
0

As the above answer states, this was removed. If you see a tutorial telling you to run rails webpack:install:react you can simply skip it if you've already run rails webpack:install. React now works "out of the box" and so you don't need to specify it.

kicksent
  • 111
  • 1
  • 3