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

Not compatible with @angular/[email protected]

Open larssn opened this issue 7 years ago • 7 comments

The error is:

You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.
  TypeError: You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.
    at Object.exports.subscribeTo (/node_modules/@angular/cli/node_modules/rxjs/src/internal/util/subscribeTo.ts:37:11)
    at Object.subscribeToResult (/node_modules/@angular/cli/node_modules/rxjs/src/internal/util/subscribeToResult.ts:18:10)
    at MergeMapSubscriber._innerSub (/node_modules/@angular/cli/node_modules/rxjs/src/internal/operators/mergeMap.ts:142:14)
    at MergeMapSubscriber._tryNext (/node_modules/@angular/cli/node_modules/rxjs/src/internal/operators/mergeMap.ts:138:10)
    at MergeMapSubscriber._next (/node_modules/@angular/cli/node_modules/rxjs/src/internal/operators/mergeMap.ts:122:12)
    at MergeMapSubscriber.Subscriber.next (/node_modules/@angular/cli/node_modules/rxjs/src/internal/Subscriber.ts:102:12)
    at MapSubscriber._next (/node_modules/@angular/cli/node_modules/rxjs/src/internal/operators/map.ts:86:22)
    at MapSubscriber.Subscriber.next (/node_modules/@angular/cli/node_modules/rxjs/src/internal/Subscriber.ts:102:12)
    at TapSubscriber._next (/node_modules/@angular/cli/node_modules/rxjs/src/internal/operators/tap.ts:116:22)
    at TapSubscriber.Subscriber.next (/node_modules/@angular/cli/node_modules/rxjs/src/internal/Subscriber.ts:102:12)
    at MergeMapSubscriber.notifyNext (/node_modules/@angular/cli/node_modules/rxjs/src/internal/operators/mergeMap.ts:155:22)
    at InnerSubscriber._next (/node_modules/@angular/cli/node_modules/rxjs/src/internal/InnerSubscriber.ts:17:17)
    at InnerSubscriber.Subscriber.next (/node_modules/@angular/cli/node_modules/rxjs/src/internal/Subscriber.ts:102:12)
    at MapSubscriber._next (/node_modules/@angular/cli/node_modules/rxjs/src/internal/operators/map.ts:86:22)
    at MapSubscriber.Subscriber.next (/node_modules/@angular/cli/node_modules/rxjs/src/internal/Subscriber.ts:102:12)
    at MergeMapSubscriber.notifyNext (/node_modules/@angular/cli/node_modules/rxjs/src/internal/operators/mergeMap.ts:155:22)

It happens on an ngw serve, probably also the other commands.

Downgrading to cli v6.1 fixes it.

larssn avatar Sep 10 '18 07:09 larssn

Please add more information

splincode avatar Sep 10 '18 07:09 splincode

I did just that. There's not much to go by.

larssn avatar Sep 10 '18 08:09 larssn

There is enough to go by. Even up to solve the problem :)

ivanpadavan avatar Sep 10 '18 08:09 ivanpadavan

Same problem, I had to fixed the version of cli to 6.1.4. Besides I tried to use @angular-builders/custom-webpack:browser but I got the error "SyntaxError: Unexpected token export" When I was building the app.

akaiserg avatar Sep 14 '18 22:09 akaiserg

~Not sure if it's an issue just with 6.2.*, I've downgrade just the CLI to 6.1.5 and I get the same error. Angular core/etc version is 6.1.8~

~Nvm, my problem, forgot to do the setup step~

Update 2: after doing the setup and fixing the angular.json for 6.1.x CLI the above error is still there using @angular/cli 6.1.4:

You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.
TypeError: You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.
    at Object.exports.subscribeTo (/Users/alex/Projects/project/node_modules/rxjs/src/internal/util/subscribeTo.ts:37:11)
    at Object.subscribeToResult (/Users/alex/Projects/project/node_modules/rxjs/src/internal/util/subscribeToResult.ts:25:10)
    at MergeMapSubscriber._innerSub (/Users/alex/Projects/project/node_modules/rxjs/src/internal/operators/mergeMap.ts:144:5)
    at MergeMapSubscriber._tryNext (/Users/alex/Projects/project/node_modules/rxjs/src/internal/operators/mergeMap.ts:138:10)
    at MergeMapSubscriber._next (/Users/alex/Projects/project/node_modules/rxjs/src/internal/operators/mergeMap.ts:122:12)
    at MergeMapSubscriber.Subscriber.next (/Users/alex/Projects/project/node_modules/rxjs/src/internal/Subscriber.ts:104:12)
    at MapSubscriber._next (/Users/alex/Projects/project/node_modules/rxjs/src/internal/operators/map.ts:86:22)
    at MapSubscriber.Subscriber.next (/Users/alex/Projects/project/node_modules/rxjs/src/internal/Subscriber.ts:104:12)
    at TapSubscriber._next (/Users/alex/Projects/project/node_modules/rxjs/src/internal/operators/tap.ts:116:22)
    at TapSubscriber.Subscriber.next (/Users/alex/Projects/project/node_modules/rxjs/src/internal/Subscriber.ts:104:12)
    at MergeMapSubscriber.notifyNext (/Users/alex/Projects/project/node_modules/rxjs/src/internal/operators/mergeMap.ts:157:22)
    at InnerSubscriber._next (/Users/alex/Projects/project/node_modules/rxjs/src/internal/InnerSubscriber.ts:17:17)
    at InnerSubscriber.Subscriber.next (/Users/alex/Projects/project/node_modules/rxjs/src/internal/Subscriber.ts:104:12)
    at MapSubscriber._next (/Users/alex/Projects/project/node_modules/rxjs/src/internal/operators/map.ts:86:22)
    at MapSubscriber.Subscriber.next (/Users/alex/Projects/project/node_modules/rxjs/src/internal/Subscriber.ts:104:12)
    at MergeMapSubscriber.notifyNext (/Users/alex/Projects/project/node_modules/rxjs/src/internal/operators/mergeMap.ts:157:22)

Update 3:

The trick was to downgrade @angular-devkit/build-angular to 0.6.7 (as the package.json of this tool suggests), this solves the above issue but creates this in the ngw.config.ts file:

export default function (config, options) {
^^^^^^

SyntaxError: Unexpected token export
    at new Script (vm.js:79:7)
    at createScript (vm.js:251:10)
    at Object.runInThisContext (vm.js:303:10)
    at Module._compile (internal/modules/cjs/loader.js:657:28)
    at Module.m._compile (/Users/alex/Projects/project/node_modules/ngw/node_modules/ts-node/src/index.ts:400:23)
    at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Object.require.extensions.(anonymous function) [as .ts] (/Users/alex/Projects/project/node_modules/ngw/node_modules/ts-node/src/index.ts:403:12)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at BrowserBuilder.configClasses.(anonymous function).(anonymous function).configClasses.(anonymous function).buildConfig (/Users/alex/Projects/project/node_modules/ngw/lib/index.js:31:31)
    at Observable.rxjs_1.Observable.obs [as _subscribe] (/Users/alex/Projects/project/node_modules/@angular-devkit/build-angular/src/dev-server/packages/angular_devkit/build_angular/src/dev-server/index.ts:115:46)
    at Observable._trySubscribe (/Users/alex/Projects/project/node_modules/rxjs/src/internal/Observable.ts:223:19)
    at Observable.subscribe (/Users/alex/Projects/project/node_modules/rxjs/src/internal/Observable.ts:204:14)

@larssn could you please post your package.json to see which of your dependencies fixes the problem?

Update 4:

Changing "module": "es2015", to "module": "commonjs", fixed the unexpected token export issue

alex88 avatar Sep 22 '18 06:09 alex88

Thank you @alex88 for the Update 4

n-lavrenko avatar Oct 15 '18 18:10 n-lavrenko

I just got the same problem with angular 7:


Angular CLI: 7.3.1
Node: 11.6.0
OS: darwin x64
Angular: 7.2.4
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.13.1
@angular-devkit/build-angular     0.13.1
@angular-devkit/build-optimizer   0.13.1
@angular-devkit/build-webpack     0.13.1
@angular-devkit/core              7.3.1
@angular-devkit/schematics        7.3.1
@angular/cli                      7.3.1
@ngtools/webpack                  7.3.1
@schematics/angular               7.3.1
@schematics/update                0.13.1
rxjs                              6.4.0
typescript                        3.2.4
webpack                           4.29.0
    

millerf avatar Feb 14 '19 11:02 millerf