简体   繁体   English

Angular 5经常性问题-Webpack无法编译一个简单项目

[英]Angular 5 recurrent issue - Webpack failed to compile a simple project

I want to create and serve a ng app. 我想创建并提供一个ng应用。 The problem is that after following the installation of angular 5 (+ionic) I found myself have the same problem over and over again and I have no idea what is causing it. 问题是在安装角度5(+离子)后,我发现自己又一次又一次遇到相同的问题,不知道是什么原因造成的。 I don't really understand what is the issue but I cannot serve any angular app. 我不太清楚问题是什么,但我无法提供任何角度的应用程序。

The way I can resolve this is by a complete format of C:\\ drive and reinstall anything from scratch. 我可以通过完整格式的C:\\驱动器来解决此问题,然后从头开始重新安装所有内容。 Last time I did it was 2 days ago. 我上次这样做是在2天前。 And before that 7 days ago. 而在那7天之前。

This is all the stuff I get in the cmd.exe: 这就是我在cmd.exe中获得的所有内容:

D:\!MY PROJECTS\APP-test>ng new engi
create engi/e2e/app.e2e-spec.ts (286 bytes)
create engi/e2e/app.po.ts (208 bytes)
create engi/e2e/tsconfig.e2e.json (235 bytes)
create engi/karma.conf.js (923 bytes)
create engi/package.json (1309 bytes)
create engi/protractor.conf.js (722 bytes)
create engi/README.md (1020 bytes)
create engi/tsconfig.json (363 bytes)
create engi/tslint.json (3097 bytes)
create engi/.angular-cli.json (1239 bytes)
create engi/.editorconfig (245 bytes)
create engi/.gitignore (516 bytes)
create engi/src/assets/.gitkeep (0 bytes)
create engi/src/environments/environment.prod.ts (51 bytes)
create engi/src/environments/environment.ts (387 bytes)
create engi/src/favicon.ico (5430 bytes)
create engi/src/index.html (291 bytes)
create engi/src/main.ts (370 bytes)
create engi/src/polyfills.ts (2405 bytes)
create engi/src/styles.css (80 bytes)
create engi/src/test.ts (1085 bytes)
create engi/src/tsconfig.app.json (211 bytes)
create engi/src/tsconfig.spec.json (304 bytes)
create engi/src/typings.d.ts (104 bytes)
create engi/src/app/app.module.ts (316 bytes)
create engi/src/app/app.component.html (1141 bytes)
create engi/src/app/app.component.spec.ts (986 bytes)
create engi/src/app/app.component.ts (207 bytes)
create engi/src/app/app.component.css (0 bytes)
Installing packages for tooling via npm.
Installed packages for tooling via npm.
Project 'engi' successfully created.

D:\!MY PROJECTS\APP-test>cd engi

D:\!MY PROJECTS\APP-test\engi>ng serve
** NG Live Development Server is listening on localhost:4200, open your 
browser on http://localhost:4200/ **
Date: 2017-12-04T19:00:14.752Z
Hash: 96b1bdc547c1ab33ed03
Time: 4145ms
chunk {inline} inline.bundle.js (inline) 5.79 kB [entry] [rendered]
chunk {main} main.bundle.js (main) 3.25 kB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js (polyfills) 257 bytes [initial] 
[rendered]
chunk {styles} styles.bundle.js (styles) 246 bytes [initial] [rendered]
chunk {vendor} vendor.bundle.js (vendor) 861 kB [initial] [rendered]

ERROR in multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts
Module not found: Error: Can't resolve 'D:\' in 'D:\!MY PROJECTS\APP-
test\engi\node_modules\@angular\cli\models\webpack-configs'
resolve 'D:\' in 'D:\!MY PROJECTS\APP-
test\engi\node_modules\@angular\cli\models\webpack-configs'
Parsed request is a directory
using description file: D:\!MY PROJECTS\APP-
test\engi\node_modules\@angular\cli\package.json (relative path: 
./models/webpack-configs)
after using description file: D:\!MY PROJECTS\APP-
test\engi\node_modules\@angular\cli\package.json (relative path: 
./models/webpack-configs)
No description file found
as directory
    existing directory
        using path: D:\index
          No description file found
        after using path: D:\index
          no extension
            D:\index doesn't exist
          .js
            D:\index.js doesn't exist
          .json
            D:\index.json doesn't exist
[D:\package.json]
[D:\index\package.json]
[D:\index]
[D:\index.js]
[D:\index.json]
 @ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts
ERROR in multi ./src/polyfills.ts
Module not found: Error: Can't resolve 'D:\' in 'D:\!MY PROJECTS\APP-
test\engi\node_modules\@angular\cli\models\webpack-configs'
resolve 'D:\' in 'D:\!MY PROJECTS\APP-
test\engi\node_modules\@angular\cli\models\webpack-configs'
Parsed request is a directory
using description file: D:\!MY PROJECTS\APP-
test\engi\node_modules\@angular\cli\package.json (relative path: 
./models/webpack-configs)
after using description file: D:\!MY PROJECTS\APP-
test\engi\node_modules\@angular\cli\package.json (relative path: 
./models/webpack-configs)
    No description file found
    as directory
      existing directory
        using path: D:\index
          No description file found
        after using path: D:\index
          no extension
            D:\index doesn't exist
          .js
            D:\index.js doesn't exist
          .json
            D:\index.json doesn't exist
[D:\package.json]
[D:\index\package.json]
[D:\index]
[D:\index.js]
[D:\index.json]
 @ multi ./src/polyfills.ts
ERROR in multi ./src/styles.css
Module not found: Error: Can't resolve 'D:\' in 'D:\!MY PROJECTS\APP-
test\engi\node_modules\@angular\cli\models\webpack-configs'
resolve 'D:\' in 'D:\!MY PROJECTS\APP-
test\engi\node_modules\@angular\cli\models\webpack-configs'
  Parsed request is a directory
  using description file: D:\!MY PROJECTS\APP-
test\engi\node_modules\@angular\cli\package.json (relative path: 
./models/webpack-configs)
  after using description file: D:\!MY PROJECTS\APP-
test\engi\node_modules\@angular\cli\package.json (relative path: 
./models/webpack-configs)
    No description file found
    as directory
      existing directory
        using path: D:\index
          No description file found
        after using path: D:\index
          no extension
            D:\index doesn't exist
          .js
            D:\index.js doesn't exist
          .json
            D:\index.json doesn't exist
[D:\package.json]
[D:\index\package.json]
[D:\index]
[D:\index.js]
[D:\index.json]
 @ multi ./src/styles.css
ERROR in   Error: Child compilation failed:
  Entry module not found: Error: Can't resolve 'D:\' in 'D:\!MY 
PROJECTS\APP-test\engi\node_modules\@angular\cli\models\webpack-configs':
  Error: Can't resolve 'D:\' in 'D:\!MY PROJECTS\APP-
test\engi\node_modules\@angular\cli\models\webpack-configs'

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

  - Compiler.js:304 compile
    [engi]/[webpack]/lib/Compiler.js:304:11

  - Compiler.js:514 applyPluginsAsync.err
    [engi]/[webpack]/lib/Compiler.js:514:14

  - Tapable.js:202 next
    [engi]/[tapable]/lib/Tapable.js:202:11

  - CachePlugin.js:78 Compiler.<anonymous>
    [engi]/[webpack]/lib/CachePlugin.js:78:5

  - Tapable.js:206 Compiler.applyPluginsAsyncSeries
    [engi]/[tapable]/lib/Tapable.js:206:13

  - Compiler.js:511 compilation.seal.err
    [engi]/[webpack]/lib/Compiler.js:511:11

  - Tapable.js:195 Compilation.applyPluginsAsyncSeries
    [engi]/[tapable]/lib/Tapable.js:195:46

  - Compilation.js:680 self.applyPluginsAsync.err
    [engi]/[webpack]/lib/Compilation.js:680:19

  - Tapable.js:195 Compilation.applyPluginsAsyncSeries
    [engi]/[tapable]/lib/Tapable.js:195:46

  - Compilation.js:671 self.applyPluginsAsync.err
    [engi]/[webpack]/lib/Compilation.js:671:11

  - Tapable.js:195 Compilation.applyPluginsAsyncSeries
    [engi]/[tapable]/lib/Tapable.js:195:46

  - Compilation.js:666 self.applyPluginsAsync.err
    [engi]/[webpack]/lib/Compilation.js:666:10

  - Tapable.js:195 Compilation.applyPluginsAsyncSeries
    [engi]/[tapable]/lib/Tapable.js:195:46

  - Compilation.js:662 sealPart2
    [engi]/[webpack]/lib/Compilation.js:662:9

  - Tapable.js:195 Compilation.applyPluginsAsyncSeries
    [engi]/[tapable]/lib/Tapable.js:195:46



  webpack: Failed to compile.

Remove the ! 删除! from your directory name. 从您的目录名称。

(Adding here from the comment for resolution) (在此处添加评论以解决)

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

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