2

I made new project with Rails and Vue using webpacker. Firstly I got strange error Cannot read property 'compile' of undefined

So I hit yarn upgrade webpack-dev-server --latest which was the correct answer and helped me but then when I hit: ./bin/webpack-dev-server my webpack dev server starts and all looks fine but at http://localhost:3035/ I am getting the "Cannot GET /" message.

JS console: Failed to load resource: the server responded with a status of 404

I also tried to reinstall webpacker...

2
  • Are you sure it's running on 3035? by default it runs on 8080 Commented Mar 7, 2018 at 18:48
  • Yep, console says "Project is running at localhost:3035" I could upload a screenshot from terminal if u want Commented Mar 7, 2018 at 19:01

1 Answer 1

1

When running your Rails application locally you'll need to start both the rails server and the webpack-dev-server. I typically use foreman with a simple Procfile, although you can also start both of these by hand.

# Procfile
server: bin/rails server
assets: bin/webpack-dev-server

Then you can run the Procfile and startup both servers with: foreman start

The webpack-dev-server port (3035) is not the port you'll be connecting to for seeing your application. Start up both servers and go to localhost:3000 and you'll see your rails application root path page (or default rails page if you dont have routes yet).

One thing to note, if you're using Foreman to start your servers it will default your rails port to 5000 instead of 3000. You can configure this either in the Procfile or when you call foreman if you want different behavior.

Sign up to request clarification or add additional context in comments.

3 Comments

Ty, all works good. Do you know some good tutorials/courses for beginner with Rails+Vue? I.E building a small app
@Daniel I do not have any resources for you. But I can say you don't need to find Rails + Vue tutorials specifically. Learn Rails and Vue separately. railscasts.com is great for learning Rails.
@Daniel, railscast.com was good, now no longer active, if you want great rails + vue tutorials, go to gorails.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.