Angular 4 - webpack:无法编译

时间:2017-07-05 11:29:09

标签: javascript angular typescript npm

当我尝试npm install时,一切似乎都运行良好,但随后ng serve会返回错误。我几乎尝试了一切,但没有任何作用。也许角度版本存在问题?同一个项目正在另一台计算机上运行。有什么建议是错的吗?

ERROR in   Error: Child compilation failed:
  Entry module not found: Error: Can't resolve '/Users/myUser/Desktop/to/Project/frontend/src/index.html' in '/Users/myUser/Desk  top/to/Project/frontend/node_modules/@angular/cli/models/webpack-configs':
  Error: Can't resolve '/Users/myUser/Desktop/to/Project/frontend/src/index.html' in '/Users/myUser/Desktop/to/Project/frontend/node  _modules/@angular/cli/models/webpack-configs'

  - compiler.js:76 
    [frontend]/[html-webpack-plugin]/lib/compiler.js:76:16

  - Compiler.js:291 Compiler.<anonymous>
    [frontend]/[webpack]/lib/Compiler.js:291:10

  - Compiler.js:494 
    [frontend]/[webpack]/lib/Compiler.js:494:13

  - Tapable.js:138 next
    [frontend]/[tapable]/lib/Tapable.js:138:11

  - CachePlugin.js:62 Compiler.<anonymous>
    [frontend]/[webpack]/lib/CachePlugin.js:62:5

  - Tapable.js:142 Compiler.applyPluginsAsyncSeries
    [frontend]/[tapable]/lib/Tapable.js:142:13

  - Compiler.js:491 
    [frontend]/[webpack]/lib/Compiler.js:491:10

  - Tapable.js:131 Compilation.applyPluginsAsyncSeries
    [frontend]/[tapable]/lib/Tapable.js:131:46

  - Compilation.js:645 self.applyPluginsAsync.err
    [frontend]/[webpack]/lib/Compilation.js:645:19

  - Tapable.js:131 Compilation.applyPluginsAsyncSeries
    [frontend]/[tapable]/lib/Tapable.js:131:46

  - Compilation.js:636 self.applyPluginsAsync.err
    [frontend]/[webpack]/lib/Compilation.js:636:11

  - Tapable.js:131 Compilation.applyPluginsAsyncSeries
    [frontend]/[tapable]/lib/Tapable.js:131:46

  - Compilation.js:631 self.applyPluginsAsync.err
    [frontend]/[webpack]/lib/Compilation.js:631:10

  - Tapable.js:131 Compilation.applyPluginsAsyncSeries
    [frontend]/[tapable]/lib/Tapable.js:131:46

  - Compilation.js:627 sealPart2
    [frontend]/[webpack]/lib/Compilation.js:627:9

  - Tapable.js:131 Compilation.applyPluginsAsyncSeries
    [frontend]/[tapable]/lib/Tapable.js:131:46


webpack: Failed to compile.

1 个答案:

答案 0 :(得分:0)

将解决方案从问题转移到答案:

  

解决方案:

     

我在文件结构中添加了index.html,一切正常。