angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.74k stars 11.98k forks source link

Build fails in --prod mode #8615

Closed darkbasic closed 6 years ago

darkbasic commented 6 years ago

Versions

$ ng --version

    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/

Angular CLI: 1.5.4 (e)
Node: 9.2.0
OS: linux x64
Angular: 5.0.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.5.4
@angular-devkit/build-optimizer: 0.0.33
@angular-devkit/core: 0.0.21
@angular-devkit/schematics: 0.0.37
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.4
@schematics/angular: 0.1.7
typescript-extends: 1.0.1
typescript: 2.4.2
webpack-concat-plugin: 1.4.0
webpack-dev-server: 2.9.4
webpack: 3.8.1

Repro steps

Observed behavior

ERROR in ./node_modules/rxjs/observable/BoundNodeCallbackObservable.js
Module build failed: TypeError: Cannot read property 'type' of undefined
    at Object.getEffectiveTypeAnnotationNode (/home/niko/WebstormProjects/angularcli-meteor/node_modules/typescript/lib/typescript.js:9341:18)
    at assignContextualParameterTypes (/home/niko/WebstormProjects/angularcli-meteor/node_modules/typescript/lib/typescript.js:41652:25)
    at checkFunctionExpressionOrObjectLiteralMethod (/home/niko/WebstormProjects/angularcli-meteor/node_modules/typescript/lib/typescript.js:41948:29)
    at checkExpressionWorker (/home/niko/WebstormProjects/angularcli-meteor/node_modules/typescript/lib/typescript.js:42959:28)
    at checkExpression (/home/niko/WebstormProjects/angularcli-meteor/node_modules/typescript/lib/typescript.js:42898:42)
    at checkExpressionCached (/home/niko/WebstormProjects/angularcli-meteor/node_modules/typescript/lib/typescript.js:42779:38)
    at checkReturnStatement (/home/niko/WebstormProjects/angularcli-meteor/node_modules/typescript/lib/typescript.js:45418:54)
    at checkSourceElement (/home/niko/WebstormProjects/angularcli-meteor/node_modules/typescript/lib/typescript.js:46763:28)
    at Object.forEach (/home/niko/WebstormProjects/angularcli-meteor/node_modules/typescript/lib/typescript.js:1506:30)
    at checkBlock (/home/niko/WebstormProjects/angularcli-meteor/node_modules/typescript/lib/typescript.js:44563:16)
    at checkSourceElement (/home/niko/WebstormProjects/angularcli-meteor/node_modules/typescript/lib/typescript.js:46742:28)
    at checkFunctionExpressionOrObjectLiteralMethodDeferred (/home/niko/WebstormProjects/angularcli-meteor/node_modules/typescript/lib/typescript.js:41990:21)
    at checkDeferredNodes (/home/niko/WebstormProjects/angularcli-meteor/node_modules/typescript/lib/typescript.js:46828:25)
    at checkSourceFileWorker (/home/niko/WebstormProjects/angularcli-meteor/node_modules/typescript/lib/typescript.js:46863:17)
    at checkSourceFile (/home/niko/WebstormProjects/angularcli-meteor/node_modules/typescript/lib/typescript.js:46842:13)
    at Object.forEach (/home/niko/WebstormProjects/angularcli-meteor/node_modules/typescript/lib/typescript.js:1506:30)
 @ ./node_modules/rxjs/observable/bindNodeCallback.js 2:36-76
 @ ./node_modules/rxjs/add/observable/bindNodeCallback.js
 @ ./node_modules/rxjs/Rx.js
 @ ./node_modules/meteor-rxjs/dist/ObservableCollection.js
 @ ./node_modules/meteor-rxjs/dist/index.js
 @ ./api/server/collections/chats.ts
 @ ./api/server/collections/index.ts
 @ ./src/app/app.component.ts
 @ ./src/app/app.module.ngfactory.js
 @ ./src/main.ts
 @ multi (webpack)-dev-server/client?http://localhost:4200 ./src/main.ts

Desired behavior

Should compile the code. Older versions of angular-cli did work fine. See the master branch here which uses 1.4.7: https://github.com/darkbasic/angularcli-meteor

Mention any other details that might be useful (optional)

The code works fine without --prod.

iursevla commented 6 years ago

Same issue but using BehaviorSubject

jasperbosch commented 6 years ago

I noticed that in the folder 'node_modules\@angular-devkit\build-optimizer\' there was no 'node_modules' folder. When copying that folder from an other project my 'ng build --prod' succeeds.

Maybe this helps in solving the problem.

filipesilva commented 6 years ago

This issue is a duplicate of https://github.com/angular/angular-cli/issues/8615 I believe, and should be fixed when https://github.com/angular/devkit/pull/299 is merged.

angular-automatic-lock-bot[bot] commented 5 years ago

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.