Angular-cli: input.mergeMap is not a function

Created on 21 Dec 2017  Â·  17Comments  Â·  Source: angular/angular-cli

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

global version @angular/[email protected]

ng g s test

error message

input.mergeMap is not a function

TypeError: input.mergeMap is not a function at Object.callRule (C:\server\htdocs\FrontEnd_AgroTaxi\node_modules\@angular-devkit\schematics\src\rules\call.js:78:18) at SchematicImpl.call (C:\server\htdocs\FrontEnd_AgroTaxi\node_modules\@angular-devkit\schematics\src\engine\schematic.js:35:23) at Promise (C:\server\htdocs\FrontEnd_AgroTaxi\node_modules\@angular\cli\tasks\schematic-run.js:77:23) at Class.run (C:\server\htdocs\FrontEnd_AgroTaxi\node_modules\@angular\cli\tasks\schematic-run.js:76:16) at Class.run (C:\server\htdocs\FrontEnd_AgroTaxi\node_modules\@angular\cli\commands\generate.js:138:33) at resolve (C:\server\htdocs\FrontEnd_AgroTaxi\node_modules\@angular\cli\ember-cli\lib\models\command.js:273:20) at Class.validateAndRun (C:\server\htdocs\FrontEnd_AgroTaxi\node_modules\@angular\cli\ember-cli\lib\models\command.js:251:12) at Promise.resolve.then.then (C:\server\htdocs\FrontEnd_AgroTaxi\node_modules\@angular\cli\ember-cli\lib\cli\cli.js:154:24)

pachage.json

{ "name": "Agrotaxi", "version": "0.0.0", "license": "MIT", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@agm/core": "1.0.0-beta.2", "@angular/animations": "4.2.0", "@angular/cdk": "2.0.0-beta.12", "@angular/common": "4.3.0", "@angular/compiler": "4.2.4", "@angular/core": "4.2.4", "@angular/forms": "4.2.4", "@angular/http": "4.2.4", "@angular/material": "2.0.0-beta.12", "@angular/platform-browser": "4.2.4", "@angular/platform-browser-dynamic": "4.2.4", "@angular/router": "4.2.4", "@ng-bootstrap/ng-bootstrap": "1.0.0-beta.5", "@types/moment": "2.13.0", "angular2-moment": "1.7.0", "bootstrap": "4.0.0-beta.2", "core-js": "2.4.1", "jquery": "3.2.1", "moment": "2.20.1", "ng2-daterangepicker": "2.0.12", "ng2-filter-pipe": "0.1.10", "ngx-order-pipe": "1.0.4", "ngx-toastr": "6.5.0", "popper.js": "1.12.5", "rxjs": "5.4.2", "zone.js": "0.8.14" }, "devDependencies": { "@angular/cli": "1.4.2", "@angular/compiler-cli": "4.2.4", "@angular/language-service": "4.2.4", "@types/googlemaps": "3.30.0", "@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" } }

investigation 1 (urgent) bufix

Most helpful comment

Same issue here.

Worked with npm i @angular-devkit/[email protected]

All 17 comments

@hansl this might be related to loose dependencies on schematics.

@filipesilva if I install @angular-devkit/[email protected] this can help? I find this solution here https://github.com/angular/angular-cli/issues/8782

Most likely cause is conflicting rxjs versions. Try changing "rxjs": "5.4.2" to "rxjs": "^5.5.2".

@clydin Does not help

Can you run npm ls rxjs within the project's directory?

@clydin
+-- UNMET PEER DEPENDENCY @angular/[email protected] +-- UNMET PEER DEPENDENCY @angular/[email protected] +-- UNMET PEER DEPENDENCY @types/jquery@^3.2.12 -- [email protected]

npm ERR! peer dep missing: @angular/common@~4.4.4, required by @angular/[email protected]
npm ERR! peer dep missing: @angular/[email protected], required by @angular/[email protected]
npm ERR! peer dep missing: @angular/common@~4.4.4, required by @angular/[email protected]
npm ERR! peer dep missing: @angular/[email protected], required by @angular/[email protected]
npm ERR! peer dep missing: @angular/[email protected], required by @angular/[email protected]
npm ERR! peer dep missing: @angular/[email protected], required by @angular/[email protected]
npm ERR! peer dep missing: @angular/[email protected], required by @angular/[email protected]
npm ERR! peer dep missing: @angular/core@~4.4.4, required by @angular/[email protected]
npm ERR! peer dep missing: @angular/[email protected], required by @angular/[email protected]
npm ERR! peer dep missing: @angular/core@~4.4.4, required by @angular/[email protected]
npm ERR! peer dep missing: @angular/core@>=4.3.0 <=6.0.0, required by [email protected]
npm ERR! peer dep missing: @types/jquery@^3.2.12, required by [email protected]
`

it's strange that with the same versions of package.json everything works on another computer.

Same issue here.

Worked with npm i @angular-devkit/[email protected]

[email protected] /mnt/c/server/htdocs/FrontEnd_AgroTaxi
├─┬ @angular/[email protected]
│ └── [email protected] deduped
└── [email protected]

rxjs success - reinstalled nodejs on 8.9.1

@HarryKural Does not help.

Moved the "node_modules" directory from the working project, and now everything works, but the strange thing is that logically if you adhere to strict versions, nothing should fall, but it turned out not to be so.

The issue appears to stem from the version of the CLI being used combined with the pinned version of rxjs that was set in the project (along with the package lock file which ensures the same version is always installed in this scenario). CLI 1.4.7 requires rxjs as ^5.4.2. Match that with the project required version (5.4.2) and with npm the CLI should only ever use 5.4.2. So the CLI was then giving a 5.4.2 version of the observable object to the schematics engine which is using rxjs 5.5.2 per its dependencies. CLI 1.5+ requires rxjs ^5.5.2.

npm i @0.0.40

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

running these two worked for me..

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's working for me

Also having this issue.

yarn ng --version
yarn run v1.3.2
$ ng --version

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

Angular CLI: 1.6.3
Node: 8.9.0
OS: darwin x64
Angular: 5.1.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.3
@angular/flex-layout: 2.0.0-beta.12
@angular-devkit/build-optimizer: 0.0.36
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.42
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.3
@schematics/angular: 0.1.11
typescript: 2.5.3
webpack: 3.10.0
✨  Done in 0.62s.

This should have been fixed a long time ago. If this still happens please create a new issue so we can follow up.

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