繁体   English   中英

Angular 4-Webpack:编译失败

[英]Angular 4 - webpack: Failed to compile

当我尝试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.

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

解:

我将index.html添加到文件结构中,并且一切正常。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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