-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Getting 'Cannot GET /' on a fresh project #1325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Try the following: At your terminal:
At
run |
It's working, I'm getting Now I don't understand. I don't need to run What is wrong with my procedure? |
maybe Read https://github.com/rails/webpacker#development
|
@JiProchazka Webpack dev server looks for a root index.html file and hence the error but that's not a problem since you are using packs inside rails views. Are you loading |
@gauravtiwari sure, |
@ytbryan |
Same issue. When trying to run the webpack dev server -- just displays "Cannot GET /". Running a rails server works just fine, but without hot reloading. |
@jcxswc Yes, that's fine since there is no index.html at the root of public/packs. For hot reloading, please make sure hot option is true in config/webpacker.yml and this is added in const renderComponent = Component =>
render(
<Component />,
document.getElementById('root')
)
renderComponent(App)
// Hot reload API
if (module.hot) {
module.hot.accept('../app', () => {
const NextApp = require('../app').default
renderComponent(NextApp)
})
} |
Here is more documentation on this: https://webpack.js.org/guides/hot-module-replacement/#enabling-hmr |
Any updates on the |
I encountered this ( |
@fakefarm Exactly so, please don't worry about webpack dev server URL and use Rails server URL instead. Everything is proxied from Rails to Webpack under the hood and everything should work as expected. |
@gauravtiwari Wonderful advice here! Thanks for that. // package.json
{
"scripts": {
"start": "npm run start:webpacker & npm run start:rails",
"start:webpacker": "./bin/webpack-dev-server --hot",
"start:rails": "rails s"
} I wanted to know: Does the advice for HMR that you mentioned still apply? Is anything major happening in Webpacker 4? (I'm on 3.5 as per dev recs) |
@OmriSama Both Webpack 4 and Webpack 5 only list HMR bug fixes so far. The only breaking change that I could find added a " Gaurav's advice still probably applies, you just need the right loaders. For the case above, you would need to set up |
Hi,
I'm starting a new rails app (5.1.4) like this:
After I'm forced to run:
and downgrade webpack-dev-server beacuse of #1303 :
And finally when I run:
I get an empty page with simple text:
And the error in chrome console is:
Will be glad to help.
Thanks
The text was updated successfully, but these errors were encountered: