ERROR in multi common Module not found: Error: Cannot resolve module 'react-router' in /path-to-project/app-name @ multi common

- 1 answer

Ad

Hopefully I can get some help with this. I am using electron (Atom Shell) with react and webpack to build the UI. When I run npm run build which is within the package.json file

 "scripts": {
    "start": "electron main.js",
    "build": "webpack --progress --profile --colors",
    "watch": "webpack-dev-server --hot --inline --progress --colors"
  },

In running npm run build I get

> [email protected] build /Users/Mavericks/Documents/apps/electron-quick-start
> webpack --progress --profile --colors

7878ms build modules
10ms seal
9ms optimize
12ms hashing
89ms create chunk assets
3ms additional chunk assets
0ms optimize chunk assets
0ms optimize assets
21ms emit
Hash: 86519e00390e81c2eee7
Version: webpack 1.12.9
Time: 8053ms
        Asset     Size  Chunks             Chunk Names
common.bin.js  1.75 MB       0  [emitted]  common
   [0] multi common 52 bytes {0} [built] [2 errors]
       factory:1ms building:2ms = 3ms
    + 158 hidden modules

ERROR in multi common
Module not found: Error: Cannot resolve module 'react-router' in /Users/Mavericks/Documents/apps/electron-quick-start
 @ multi common

ERROR in multi common
Module not found: Error: Cannot resolve module 'alt' in /Users/Mavericks/Documents/apps/electron-quick-start
 @ multi common

ERROR in ./lib/main.js
Module build failed: SyntaxError: /Users/Mavericks/Documents/apps/electron-quick-start/lib/main.js: Unexpected token (4:4)
  2 |
  3 | React.render(
> 4 |     <div className="container"> My Name is CTL</div>,
    |     ^
  5 |   document.getElementById('content')
  6 | );
  7 |

I understand that the 3rd error (ERROR in ./lib/main.js) its base on babel not compiling the ES6 code. My main issue is why I'm i getting the others

ERROR in multi common
Module not found: Error: Cannot resolve module 'react-router' in /Users/Mavericks/Documents/apps/electron-quick-start
 @ multi common

ERROR in multi common
Module not found: Error: Cannot resolve module 'alt' in /Users/Mavericks/Documents/apps/electron-quick-start
 @ multi common

What I've done prior to my question I removed the node_modules folder and ran npm install..... still get the same error.

Thank you in advance.

Ad

Answer

Ad

Those errors mean that you haven't installed the corresponding modules. Run npm install --save alt react-router.

Ad
source: stackoverflow.com
Ad