简体   繁体   中英

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

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

> electron-quick-start@0.0.1 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM