small medium large xlarge

Back to: All Forums  React for Real
13 Nov 2017, 21:29
Mark Miranda (2 posts)

When I try to npm start after creating the reducers and store, I get this error:

ERROR in multi (webpack)-dev-server/client?http://localhost:8080 ./src/index.js Module not found: Error: Can't resolve './src/index.js'

I then copied and erased src/index.js from wordcounter into movieguide, but then nothing loads and the redux devtools say No store found.

15 Nov 2017, 11:13
Ludovico Fischer (9 posts)

Hi Mark,

did you manage to make it work eventually? I’ve checked the book and it looks like I’ve indeed made an oversight in the tutorial. The webpack configuration expects src/index.js to be present, but the book hasn’t yet told what to put in that file. The following step should fix this.

Before typing npm start, create a file in src/index.jswith the following content:

import store from './store';

This brings in the Redux store you created in src/store.js and you can then inspect it with the Redux devtools in the browser.

Sorry about the issue, I’ll make sure to correct it if a second edition comes out!

15 Nov 2017, 23:59
Mark Miranda (2 posts)

I have not fixed it. I tried your suggetion and am now running into this error.

Thanks for the response.

ERROR in ./src/reducers.js
Module build failed: SyntaxError: 'import' and 'export' may only appear at the top level (47:0)

  45 | }
  46 |
> 47 | export default combineReducers({ movies, filter, favorites, loading });
     | ^
  48 |

 @ ./src/store.js 3:0-37
 @ ./src/index.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 ./src/index.js
webpack: Failed to compile.
16 Nov 2017, 19:15
Ludovico Fischer (9 posts)

It looks like there’s a syntax error in your reducers.js file. If you post the whole file I can probably help you, otherwise compare what you wrote with the sample code

You must be logged in to comment