angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Quick Consecutive Save causes error in build

Open anandchakru opened this issue 9 years ago • 10 comments

Bug Report or Feature Request (mark with an x)

- [ X ] bug report -> please search issues before submitting
- [ ] feature request

Versions.

chakru@T430:~$ ng --version
    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.4.2
node: 6.11.3
os: linux x64
@angular/animations: 4.4.1
@angular/common: 4.4.1
@angular/compiler: 4.4.1
@angular/core: 4.4.1
@angular/forms: 4.4.1
@angular/http: 4.4.1
@angular/platform-browser: 4.4.1
@angular/platform-browser-dynamic: 4.4.1
@angular/router: 4.4.1
@angular/cli: 1.4.2
@angular/compiler-cli: 4.4.1
@angular/language-service: 4.4.1
typescript: 2.3.4

chakru@T430:~$ node --version
v6.11.3

chakru@T430:~$ npm --version
3.10.10

chakru@T430:~$ lsb_release -a
Distributor ID: Ubuntu
Description:  Ubuntu 16.04.3 LTS
Release:  16.04
Codename: xenial

Repro steps.

  • start listening on file change to continuously build using ng serve
  • edit a file and save
  • before the previous build finishes, edit again and hit save

The log given by the failure.

Uncaught Error: Unexpected value 'undefined' declared by the module 'AppModule'
    at syntaxError (compiler.es5.js:1694)
    at compiler.es5.js:15574
    at Array.forEach (<anonymous>)
    at CompileMetadataResolver.webpackJsonp.../../../compiler/@angular/compiler.es5.js.CompileMetadataResolver.getNgModuleMetadata (compiler.es5.js:15572)
    at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler._loadModules (compiler.es5.js:26958)
    at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler._compileModuleAndComponents (compiler.es5.js:26931)
    at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler.compileModuleAsync (compiler.es5.js:26860)
    at PlatformRef_.webpackJsonp.../../../core/@angular/core.es5.js.PlatformRef_._bootstrapModuleWithZone (core.es5.js:4536)
    at PlatformRef_.webpackJsonp.../../../core/@angular/core.es5.js.PlatformRef_.bootstrapModule (core.es5.js:4522)
    at Object.../../../../../src/main.ts (main.ts:11)

Desired functionality.

Handle the second save with a full file refresh

Mention any other details that might be useful.

package.json:

{
  "name": "appv7",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "s": "ng serve --proxy-config proxy.conf.json",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^4.2.4",
    "@angular/common": "^4.2.4",
    "@angular/compiler": "^4.2.4",
    "@angular/core": "^4.2.4",
    "@angular/forms": "^4.2.4",
    "@angular/http": "^4.2.4",
    "@angular/platform-browser": "^4.2.4",
    "@angular/platform-browser-dynamic": "^4.2.4",
    "@angular/router": "^4.2.4",
    "@types/pikaday": "^1.6.1",
    "@types/googlemaps": "^3.26.17",
    "angular2-markdown": "^1.5.1",
    "angular2-text-mask": "^8.0.1",
    "bootstrap": "^3.3.7",
    "bootswatch": "^3.3.7",
    "core-js": "^2.4.1",
    "font-awesome": "^4.7.0",
    "html2canvas": "^0.5.0-beta4",
    "jquery": "^3.1.1",
    "js-beautify": "^1.6.14",
    "moment": "^2.17.1",
    "mustache": "^2.3.0",
    "ng2-completer": "^1.4.0",
    "ng2-toasty": "^4.0.0",
    "ngx-bootstrap": "^1.6.6",
    "pikaday": "^1.6.1",
    "rxjs": "^5.4.2",
    "simplemde": "^1.11.2",
    "sweetalert2": "^6.4.4",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular/cli": "1.4.2",
    "@angular/compiler-cli": "^4.2.4",
    "@angular/language-service": "^4.2.4",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "~3.1.1",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.2.0",
    "tslint": "~5.3.2",
    "typescript": "~2.3.3",
    "@types/codemirror": "0.0.40",
    "@types/html2canvas": "^0.5.33",
    "@types/js-beautify": "0.0.29",
    "@types/mustache": "^0.8.29",
    "@types/simplemde": "^1.11.6"
  }
}

anandchakru avatar Sep 19 '17 06:09 anandchakru

We've been having this issue ever since we upgraded from 1.3 to 1.4. It seems to happen randomly. Sometimes it refreshes fine, some other times we get that error. Sometimes if I go to the app module and just save the file without any changes, then it will trigger a clean refresh for the changes on other files. But most of the time we have to restart the server.

elclanrs avatar Sep 20 '17 14:09 elclanrs

Glad to see this is confirmed, thought I was going crazy. It started happening to us as well when we upgraded from 1.2.6 to 1.4.3. Restarting the server helps, however, it randomly does it again. We noticed that it was more frequent when we would update an ng service file for the first time, in a long time. Then, consecutive refreshes were fine until it sat for a bit. As soon as a service was updated again, it would break.

EDIT: Forgot to add that it seems to only affect macOS. We have a large team working on various machines and the WinOS machines appear to be unaffected by 1.4.3.

iplaksiy avatar Sep 29 '17 13:09 iplaksiy

Running into the same issue after upgrading from angular-cli 1.2.3 to 1.4.2 and angular from 4.3.1 to 4.4.3

abeymg avatar Oct 02 '17 23:10 abeymg

It happens to me almost every day after an TS error (some type mismatch) then nothing helps but restart the ng-cli. It makes development almost impossible as most of the time I spent on waiting for ng to restart :(

gooor avatar Oct 17 '17 12:10 gooor

Updated to 1.4.9 and still experiencing the same behavior.

iplaksiy avatar Oct 23 '17 20:10 iplaksiy

Is there an update / ETA on this? I am surprised not more people are complaining about this. Seems to be a very common and basic use case that is broken.

abeymg avatar Oct 31 '17 19:10 abeymg

Same problem for me using 1.4.9 cli when running ng serve. Usual occurs after an Typescript compile error and is resolved by restarting the cli.

cli: 1.4.9 angular: 4.4.6 typescript: 2.3.4

If anymore info is needed let me know, will gladly help out.

rthewhite avatar Nov 01 '17 11:11 rthewhite

Any updates on this issue? I hit this problem multiple times a day and am required to restart the server each time which slows down development.

dominiclaudate avatar Nov 16 '17 16:11 dominiclaudate

Thanks for reporting this issue. This issue was originally reported a long time ago and since then we've had many releases, one of which might have addressed this problem. Please update to the most recent Angular CLI version.

If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.

filipesilva avatar Oct 01 '19 16:10 filipesilva

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.