简体   繁体   中英

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

I want to create and serve a ng app. 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. 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. Last time I did it was 2 days ago. And before that 7 days ago.

This is all the stuff I get in the 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)

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