Angular-cli: Error after updating to 6.0.0

Created on 10 May 2018  Â·  9Comments  Â·  Source: angular/angular-cli

Versions

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / â–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 6.0.0
Node: 8.11.1
OS: win32 x64
Angular: 6.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.0
@angular-devkit/build-angular     0.6.0
@angular-devkit/build-optimizer   0.6.0
@angular-devkit/core              0.6.0
@angular-devkit/schematics        0.6.0
@angular/flex-layout              6.0.0-beta.15
@angular/material                 6.0.1
@ngtools/webpack                  6.0.0
@schematics/angular               0.6.0
@schematics/update                0.6.0
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.6.0

Repro steps

  • Deleted node_modules
  • Removed all global npm packages
  • npm install -g @angular/cli
  • npm install
  • ng serve

Observed behavior

PS > ng serve
** Angular Live Development Server is listening on localhost: 4200, open your browser on http://localhost:4200/ **

Date: 2018-05-10T14:01:18.446Z
Hash: 3c16fcc5a31cf6d5eb28
Time: 6202ms
chunk {main} main.js, main.js.map (main) 1.94 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 686 bytes [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 5.4 kB [entry] [rendered]
chunk {scripts} scripts.js, scripts.js.map (scripts) 194 kB  [rendered]
chunk {styles} styles.js, styles.js.map (styles) 640 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 325 kB [initial] [rendered]

ERROR in ENOENT: no such file or directory, stat 'C:\C\Users\username\Documents\project\project\src\app\app.module.ts'
i ï½¢wdmï½£: Failed to compile.

Desired behavior

The extra C/\ should be removed from the C:\C\Users path so app.module.ts can be found.

Mention any other details that might be useful (optional)

I followed all the upgrade steps from https://update.angular.io/. Upgrading from 5.0 to 6.0.

Angular.json

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "ECAT": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "tsConfig": "src/tsconfig.app.json",
            "preserveSymlinks": true,
            "polyfills": "src/polyfills.ts",
            "assets": [
              "src/assets",
              "src/favicon.ico"
            ],
            "styles": [
              "src/styles.scss",
              "src/theme.scss",
              "node_modules/@covalent/core/common/platform.css",
              "node_modules/dragula/dist/dragula.css"
            ],
            "scripts": [
              "node_modules/hammerjs/hammer.min.js",
              "node_modules/showdown/dist/showdown.js"
            ]
          },
          "configurations": {
            "42dev": {
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.42Dev.ts"
                }
              ]
            },
            "production": {
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ]
            },
            "stage": {
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.stage.ts"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "ECAT:build",
            "port": 4200,
            "host": "localhost"
          },
          "configurations": {
            "42dev": {
              "browserTarget": "ECAT:build:42dev"
            },
            "production": {
              "browserTarget": "ECAT:build:production"
            },
            "stage": {
              "browserTarget": "ECAT:build:stage"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "ECAT:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "karmaConfig": "./karma.conf.js",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "scripts": [
              "node_modules/hammerjs/hammer.min.js",
              "node_modules/showdown/dist/showdown.js"
            ],
            "styles": [
              "src/styles.scss",
              "src/theme.scss",
              "node_modules/@covalent/core/common/platform.css",
              "node_modules/dragula/dist/dragula.css"
            ],
            "assets": [
              "src/assets",
              "src/favicon.ico"
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "src/tsconfig.app.json",
              "src/tsconfig.spec.json"
            ],
            "exclude": []
          }
        }
      }
    },
    "ECAT-e2e": {
      "root": "",
      "sourceRoot": "",
      "projectType": "application",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "./protractor.conf.js",
            "devServerTarget": "ECAT:serve"
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "e2e/tsconfig.e2e.json"
            ],
            "exclude": []
          }
        }
      }
    }
  },
  "defaultProject": "ECAT",
  "schematics": {
    "@schematics/angular:component": {
      "prefix": "app",
      "styleext": "scss"
    },
    "@schematics/angular:directive": {
      "prefix": "app"
    }
  }
}

package.json

{
  "name": "ecat",
  "version": "2.0.0",
  "private": true,
  "description": "epme course applicaton toolkit",
  "keywords": [
    "angular",
    "components",
    "reusable"
  ],
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "bundle-report": "webpack-bundle-analyzer dist/stats.json",
    "ng-high-mem": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng"
  },
  "repository": "https://github.com/teradata/covalent-quickstart.git",
  "license": "MIT",
  "author": "BCEE",
  "contributors": [
    "Jeremiah Beckham",
    "Richard Chauvin",
    "Anthony Inauen",
    "Jason Silvers"
  ],
  "dependencies": {
    "@angular/animations": "^6.0.0",
    "@angular/common": "^6.0.0",
    "@angular/compiler": "^6.0.0",
    "@angular/cdk": "^6.0.0",
    "@angular/core": "^6.0.0",
    "@angular/flex-layout": "^6.0.0-beta.15",
    "@angular/forms": "^6.0.0",
    "@angular/http": "^6.0.0",
    "@angular/material": "6.0.1",
    "@angular/platform-browser": "^6.0.0",
    "@angular/platform-browser-dynamic": "^6.0.0",
    "@angular/router": "^6.0.0",
    "@auth0/angular-jwt": "2.0.0",
    "@covalent/core": "git+https://github.com/Teradata/covalent-nightly.git",
    "@swimlane/ngx-charts": "8.0.0",
    "@types/lodash": "4.14.108",
    "breeze-bridge2-angular": "1.0.0",
    "breeze-client": "1.7.1",
    "core-js": "^2.5.4",
    "d3": "5.2.0",
    "hammerjs": "2.0.8",
    "highlight.js": "9.12.0",
    "ng2-dragula": "1.5.0",
    "rxjs": "^6.0.0",
    "showdown": "1.8.6",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular/cli": "^6.0.0",
    "@angular/compiler-cli": "^6.0.0",
    "@types/hammerjs": "2.0.35",
    "@types/jasmine": "2.5.49",
    "@types/node": "~6.0.60",
    "@types/selenium-webdriver": "2.53.36",
    "codelyzer": "4.3.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-firefox-launcher": "1.0.0",
    "karma-jasmine": "^1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "phantomjs-prebuilt": "2.1.7",
    "protractor": "~5.1.0",
    "ts-node": "~2.1.0",
    "tslint": "~5.2.0",
    "typescript": "~2.7.2",
    "webpack-bundle-analyzer": "2.11.1",
    "@angular-devkit/build-angular": "~0.6.0"
  }
}

Most helpful comment

@enderjs
I found a little bugger!
In main.ts change

import { AppModule } from './app/';

to

import { AppModule } from './app/app.module';

At least this worked for me. This was actually 'autofixed' by WebStorm ('Import can be shortened')

Strangely, this used to work in my app from December 2016 till now.

All 9 comments

It seems to be related to my computer. I tried it on another and it worked.

I completely deleted node.js and all references to npm and tried again with the same result.

Maybe I missed something. Any advice?

Thanks.

you tried checkout out your project to another folder? maybe something on a very low directory path like c:\dev?
if its related to your computer, its there an env variable that overwrites something?

Still no luck.

I tried removing every reference to node.js and npm. Deleted all code on computer and started with a new checkout at C:\dev.

Same error

Date: 2018-05-11T17:50:18.591Z
Hash: 14d882389d0b0928ec25
Time: 6658ms
chunk {main} main.js, main.js.map (main) 1.89 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 663 bytes [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 5.4 kB [entry] [rendered]
chunk {scripts} scripts.js, scripts.js.map (scripts) 194 kB  [rendered]
chunk {styles} styles.js, styles.js.map (styles) 620 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 325 kB [initial] [rendered]

ERROR in ENOENT: no such file or directory, stat 'C:\C\dev\EcatClient\src\app\app.module.ts'
i ï½¢wdmï½£: Failed to compile.

@enderjs
I've just bumped into this one (also windows 10). At least your computer is not the only one out there with this issue :)

This is very similar to https://github.com/angular/angular-cli/issues/10214
However, the fix (removing yarn lock and node_modules and then installing deps) didn't work for me.

Any updates on this one?

I tested this on my Mac and it worked. Maybe it is a Windows only issue?

@enderjs
I found a little bugger!
In main.ts change

import { AppModule } from './app/';

to

import { AppModule } from './app/app.module';

At least this worked for me. This was actually 'autofixed' by WebStorm ('Import can be shortened')

Strangely, this used to work in my app from December 2016 till now.

@dojchek

Great catch!!

Your solution worked for me as well.

Glad to hear it worked for you as well! :)
I assume this issue can be closed now?

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

IngvarKofoed picture IngvarKofoed  Â·  3Comments

jmurphzyo picture jmurphzyo  Â·  3Comments

NCC1701M picture NCC1701M  Â·  3Comments

hartjo picture hartjo  Â·  3Comments

hareeshav picture hareeshav  Â·  3Comments