Angular-cli: ng g input.mergeMap is not a function

Created on 7 Dec 2017  ยท  41Comments  ยท  Source: angular/angular-cli

ng g app-shell works on a fresh app but on my project I get the following error but no idea what it means

TypeError: input.mergeMap is not a function
    at Object.callRule (/node_modules/@angular-devkit/schematics/src/rules/call.js:70:18)
    at SchematicImpl.call (/node_modules/@angular-devkit/schematics/src/engine/schematic.js:35:23)
    at Promise (/node_modules/@angular/cli/tasks/schematic-run.js:73:23)
    at new Promise (<anonymous>)
    at Class.run (/node_modules/@angular/cli/tasks/schematic-run.js:72:16)
    at Class.run (/node_modules/@angular/cli/commands/generate.js:152:33)
    at resolve (/node_modules/@angular/cli/ember-cli/lib/models/command.js:261:20)
    at new Promise (<anonymous>)
    at Class.validateAndRun (/node_modules/@angular/cli/ember-cli/lib/models/command.js:240:12)
    at Promise.resolve.then.then (/node_modules/@angular/cli/ember-cli/lib/cli/cli.js:140:24)

The only thing I can think of is it's a multi app setup structured like

  -- client
      -- app
  -- admin
      -- app
  -- environments

but I've tried setting the root and get the same result

ng generate app-shell [ --universal-app universal --root src/client ]
1 (urgent) broken

Most helpful comment

I was able to fix installing this locally @angular-devkit/[email protected]

All 41 comments

Same happens with ng g component [componentname] or ng g module [modulename]

ng generate module public-library/trial
input.mergeMap is not a function
TypeError: input.mergeMap is not a function
    at Object.callRule (/mnt/d/dev/bereslim/bsm-ui/node_modules/@angular-devkit/schematics/src/rules/call.js:70:18)
    at SchematicImpl.call (/mnt/d/dev/bereslim/bsm-ui/node_modules/@angular-devkit/schematics/src/engine/schematic.js:35:23)
    at Promise (/mnt/d/dev/bereslim/bsm-ui/node_modules/@angular/cli/tasks/schematic-run.js:73:23)
    at new Promise (<anonymous>)
    at Class.run (/mnt/d/dev/bereslim/bsm-ui/node_modules/@angular/cli/tasks/schematic-run.js:72:16)
    at Class.run (/mnt/d/dev/bereslim/bsm-ui/node_modules/@angular/cli/commands/generate.js:152:33)
    at resolve (/mnt/d/dev/bereslim/bsm-ui/node_modules/@angular/cli/ember-cli/lib/models/command.js:261:20)
    at new Promise (<anonymous>)
    at Class.validateAndRun (/mnt/d/dev/bereslim/bsm-ui/node_modules/@angular/cli/ember-cli/lib/models/command.js:240:12)
    at Promise.resolve.then.then (/mnt/d/dev/bereslim/bsm-ui/node_modules/@angular/cli/ember-cli/lib/cli/cli.js:140:24)

```console
ng --version

_                      _                 ____ _     ___

/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ โ–ณ \ | '_ \ / _| | | | |/ _ | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ __| |_|__, |__,_|_|__,_|_| ____|_____|___|
|___/

Angular CLI: 1.6.0
Node: 8.7.0
OS: linux x64
Angular: 5.1.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router

@angular/cdk: 5.0.0
@angular/cli: 1.6.0
@angular/flex-layout: 2.0.0-beta.10-4905443
@angular/material-moment-adapter: 5.0.0
@angular/material: 5.0.0
@angular-devkit/build-optimizer: 0.0.35
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.41
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.0
@schematics/angular: 0.1.10
typescript: 2.5.3
webpack: 3.10.0

yarn install
```console
warning @schematics/[email protected]" has incorrect peer dependency "@angular-devkit/[email protected]".
warning "@schematics/[email protected]" has incorrect peer dependency "@angular-devkit/[email protected]".

facing the same issue.

ng g c temp-component
Your global Angular CLI version (1.5.0) is greater than your local
version (1.4.3). The local Angular CLI version is used.

To disable this warning use "ng set --global warnings.versionMismatch=false".
input.mergeMap is not a function
TypeError: input.mergeMap is not a function

at Object.callRule

$ ng --version
Your global Angular CLI version (1.5.0) is greater than your local
version (1.4.3). The local Angular CLI version is used.

To disable this warning use "ng set --global warnings.versionMismatch=false".
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ โ–ณ \ | '_ \ / _| | | | |/ _ | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ __| |_|__, |__,_|_|__,_|_| ____|_____|___|
|___/
@angular/cli: 1.4.3 (e)
node: 6.11.4
os: win32 x64
@angular/animations: 4.4.3
@angular/common: 4.4.3
@angular/compiler: 4.4.3
@angular/core: 4.4.3
@angular/forms: 4.4.3
@angular/http: 4.4.3
@angular/platform-browser: 4.4.3
@angular/platform-browser-dynamic: 4.4.3
@angular/router: 4.4.3
@angular/cli: 1.4.3
@angular/compiler-cli: 4.4.3
typescript: 2.5.2

upgraded below packages and it started working again.'

Ok so deleting node_modules and reinstalling seems to clear that error but faced with a new error of

Error: Specified module does not exist
Specified module does not exist

Same issue here after updating CLI from 1.5.2 to 1.6.0

The same is happening with:
ng generate module module-name

I think the issue is with all commands of angular cli.

If you are receiving an error other than Specified module does not exist please create a new issue with your error and steps to recreate.

exact same issue:
input.mergeMap is not a function
TypeError: input.mergeMap is not a function
at Object.callRule (/home/nils/Documents/DEV2017A/angular5-heroes/node_modules/@angular-devkit/schematics/src/rules/call.js:70:18)
at SchematicImpl.call (/home/nils/Documents/DEV2017A/angular5-heroes/node_modules/@angular-devkit/schematics/src/engine/schematic.js:35:23)
at Promise (/home/nils/Documents/DEV2017A/angular5-heroes/node_modules/@angular/cli/tasks/schematic-run.js:73:23)
at Promise ()
at Class.run (/home/nils/Documents/DEV2017A/angular5-heroes/node_modules/@angular/cli/tasks/schematic-run.js:72:16)
at Class.run (/home/nils/Documents/DEV2017A/angular5-heroes/node_modules/@angular/cli/commands/generate.js:152:33)
at resolve (/home/nils/Documents/DEV2017A/angular5-heroes/node_modules/@angular/cli/ember-cli/lib/models/command.js:261:20)
at Promise ()
at Class.validateAndRun (/home/nils/Documents/DEV2017A/angular5-heroes/node_modules/@angular/cli/ember-cli/lib/models/command.js:240:12)
at Promise.resolve.then.then (/home/nils/Documents/DEV2017A/angular5-heroes/node_modules/@angular/cli/ember-cli/lib/cli/cli.js:140:24)

/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ โ–ณ \ | '_ \ / _| | | | |/ _ | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ __| |_|__, |__,_|_|__,_|_| ____|_____|___|
|___/

Angular CLI: 1.6.0
Node: 8.3.0
OS: linux x64
Angular: 5.1.0
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic
... platform-server, router

@angular/cli: 1.6.0
@angular/language-service: 4.4.6
@angular-devkit/build-optimizer: 0.0.35
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.41
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.0
@schematics/angular: 0.1.10
@schematics/schematics: 0.0.10
typescript: 2.4.2
webpack: 3.10.0

It seems that if you have @angular/cli installed globally and a different version installed locally it gets broken.
I solved the same error removing the cli package that was installed locally with npm remove @angular/cli --save in my project folder.

same error Your global Angular CLI version (1.6.0) is greater than your local
version (1.4.9). The local Angular CLI version is used.

To disable this warning use "ng set --global warnings.versionMismatch=false".
input.mergeMap is not a function
TypeError: input.mergeMap is not a function

It seems that if you have @angular/cli installed globally and a different version installed locally it gets broken.
I solved the same error removing the cli package that was installed locally with npm remove @angular/cli --save in my project folder.

Both my global and local version are the same.

But.... uninstalling the local (project) cli works. ๐Ÿ‘

[edit]
The other way around => uninstall global and install local project CLI results in the same error.
So it seems to be a problem with the local (project) cli

Removing local @angular/cli can resolve this issue, but globally CLI can't add automatically the references to the related local ts files.

Same issue here, removing the local cli doesn't really sound like a solution

I was able to fix installing this locally @angular-devkit/[email protected]

I'm getting the same error after upgrading to latest angular-cli

resolved after deleting local node_modules directory and running npm install

I got this error when had package.json with typescript >2.5 with typescript 2.6 installed. saying =2.5.3; and doing the npm/node modules 'cleanse' (i.e. npm cache clear, rmdir node_modules and npm uninstall @angular/cli -g, npm remove @angular/cli ) finally did the trick for me with an upgraded project. hope that can help someone else.

I solved it when I updated the typescript's version (local and global).

I solved the problem be removing local version of angular CLI:

npm remove @angular/cli --save

Had the same issue after upgrading @angular/cli to version 1.6.0 both globally and locally. I tried a proposed resolution of upgrading rxjs version to 5.5.5 but that didn't still solve the issue.

Command ran:
ng g service was throwing the same error

Error:
_input.mergeMap is not a function
TypeError: input.mergeMap is not a function
at Object.callRule (.../@angular-devkit/schematics/src/rules/call.js:70:18)_

Temporary Resolution:
Reverted to v1.5.0 of @angular/cli, deleted node_modules and ran yarn install again

Further Information
OS: Ubuntu 16.04
Seems the dependencies for @angular/cli and @angular-devkit/schematics are not upgraded
โ”œโ”€ @angular-devkit/[email protected]
โ”‚ โ”œโ”€ @angular-devkit/[email protected]
โ”‚ โ”œโ”€ @ngtools/json-schema@^1.1.0
โ”‚ โ”œโ”€ @schematics/[email protected]
โ”‚ โ”œโ”€ minimist@^1.2.0
โ”‚ โ”œโ”€ rxjs@^5.5.2
โ”‚ โ”œโ”€ [email protected]
โ”‚ โ”‚ โ””โ”€ symbol-observable@^1.0.1
โ”‚ โ””โ”€ [email protected]
โ”œโ”€ @angular/[email protected]
โ”‚ โ””โ”€ tslib@^1.7.1
โ”œโ”€ @angular/[email protected]
โ”‚ โ”œโ”€ @angular-devkit/build-optimizer@~0.0.35
โ”‚ โ”œโ”€ @angular-devkit/schematics@~0.0.40
โ”‚ โ”œโ”€ @ngtools/[email protected]
โ”‚ โ”œโ”€ @ngtools/[email protected]
โ”‚ โ”œโ”€ @schematics/angular@~0.1.10
โ”‚ โ”œโ”€ autoprefixer@^6.5.3
โ”‚ โ”œโ”€ chalk@~2.2.0
โ”‚ โ”œโ”€ [email protected]
โ”‚ โ”‚ โ”œโ”€ ansi-styles@^3.1.0
โ”‚ โ”‚ โ”œโ”€ escape-string-regexp@^1.0.5
โ”‚ โ”‚ โ””โ”€ supports-color@^4.0.0
โ”‚ โ”œโ”€ circular-dependency-plugin@^4.2.1
โ”‚ โ”œโ”€ common-tags@^1.3.1
โ”‚ โ”œโ”€ copy-webpack-plugin@^4.1.1
โ”‚ โ”œโ”€ core-object@^3.1.0
โ”‚ โ”œโ”€ css-loader@^0.28.1
โ”‚ โ”œโ”€ cssnano@^3.10.0
โ”‚ โ”œโ”€ denodeify@^1.2.1
โ”‚ โ”œโ”€ ember-cli-string-utils@^1.0.0
โ”‚ โ”œโ”€ exports-loader@^0.6.3
โ”‚ โ”œโ”€ extract-text-webpack-plugin@^3.0.2
โ”‚ โ”œโ”€ file-loader@^1.1.5
โ”‚ โ”œโ”€ fs-extra@^4.0.0
โ”‚ โ”œโ”€ glob@^7.0.3
โ”‚ โ”œโ”€ html-webpack-plugin@^2.29.0
โ”‚ โ”œโ”€ istanbul-instrumenter-loader@^2.0.0
โ”‚ โ”œโ”€ karma-source-map-support@^1.2.0
โ”‚ โ”œโ”€ less-loader@^4.0.5
โ”‚ โ”œโ”€ less@^2.7.2
โ”‚ โ”œโ”€ license-webpack-plugin@^1.0.0
โ”‚ โ”œโ”€ lodash@^4.11.1
โ”‚ โ”œโ”€ memory-fs@^0.4.1
โ”‚ โ”œโ”€ minimatch@^3.0.4
โ”‚ โ”œโ”€ node-modules-path@^1.0.0
โ”‚ โ”œโ”€ node-sass@^4.3.0
โ”‚ โ”œโ”€ nopt@^4.0.1
โ”‚ โ”œโ”€ opn@~5.1.0
โ”‚ โ”œโ”€ portfinder@~1.0.12
โ”‚ โ”œโ”€ postcss-custom-properties@^6.1.0
โ”‚ โ”œโ”€ postcss-loader@^2.0.8
โ”‚ โ”œโ”€ postcss-url@^7.1.2
โ”‚ โ”œโ”€ raw-loader@^0.5.1
โ”‚ โ”œโ”€ resolve@^1.1.7
โ”‚ โ”œโ”€ rxjs@^5.5.2
โ”‚ โ”œโ”€ [email protected]
โ”‚ โ”‚ โ””โ”€ symbol-observable@^1.0.1

I had the same issue after upgrading to the @angular/cli 1.6.0 and was able to resolve it using:
npm i --save-dev @angular/cli@latest
and
npm i typescript@latest -g
as some others mentioned above.

The versions of Angular Cli and TypeScript (local and global) must be the same.
Execute:
ng -v
tsc -v

Then see the versions in package.json. If they are different, then update them.

Globally

npm remove -g @angular/cli
npm remove -g typescript

npm i -g @angular/cli@latest
npm i -g typescript@latest

Locally

Delete the directories node_modules and dist of your project.

npm i @angular/cli@latest --save-dev
npm i typescript@latest --save-dev
npm install

That was working for me.

After upgrading from 4 to 5, I had to delete package-lock.json and run npm install - that fixed the problem.

tried all mentioned solutions but doesn't work for me.
I have the latest versions of CLI and TS both locally and globally. Removing node_modules and installing it doesn't help. Removing package-lock.json doesn't help either.

Any other variants?

@matiishyn Did you make sure to clear out your global cached files before installing the global CLI and TS? Also, is your rxjs@^5.5.5?

Just did, same error. And yes, rxjs@^5.5.5.
What else can I do?

@matiishyn - I can't find the reference now, but a similar issue was fixed for me by
npm install @angular-devkit/[email protected]

Installing @angular-devkit/[email protected] seems to have solved the problem for me. Worked like magic

Had same problem.
Tried all recommendations above.
Only deleting node_modules and package-lock.json worked out.

Installing rxjs@^5.5.5 on angular/cli worked for me.

rm package-lock.json
npm install @angular-devkit/[email protected] --save-dev

worked for me!

npm i @angular-devkit/[email protected]

npm install --save-dev @angular/cli@latest

running these two worked for me..

ๆŠŠ้กน็›ฎ็š„angular็‰ˆๆœฌๆ›ดๆ–ฐๅˆฐ5.0.0ๅฏไปฅๅฝปๅบ•่งฃๅ†ณ่ฟ™ไธช้—ฎ้ข˜ใ€‚

Can someone explain WHY npm install @angular-devkit/[email protected] --save-dev fixes it?

And also why schematics isn't in my package.json file after running this - yes it does work?

CLI isn't compatible with typescript 2.6 or above - so run this.

npm install typescript@'>=2.4.2 <2.6.0

Changing schematics worked for me too but then I get another error saying it needed 0.0.42. So I installed 0.0.42 and then typescript 2.5 and it worked again

@joseques Thanks. uninstalling the local angular CLI worked.

installed latest one and working fine

npm install @angular-devkit/schematics --save-dev

@BenevidesLecontes got You seem to not be depending on "@angular/core. This is an error.' after successfully creating a component. This was after I ran npm install @angular-devkit/schematics --save-dev

I too had the same problem, it worked after I removed cli from the local project.

npm remove @angular/cli --save

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.

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