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

ng g input.mergeMap is not a function

Open dottodot opened this issue 8 years ago • 41 comments

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

src
  -- 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 ]

dottodot avatar Dec 07 '17 10:12 dottodot

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.

maplion avatar Dec 11 '17 21:12 maplion

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.

sergiohidalgocaceres avatar Dec 11 '17 22:12 sergiohidalgocaceres

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

tameemi avatar Dec 12 '17 21:12 tameemi

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 avatar Dec 13 '17 20:12 matiishyn

@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?

maplion avatar Dec 13 '17 20:12 maplion

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

matiishyn avatar Dec 13 '17 20:12 matiishyn

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

PooperPig avatar Dec 14 '17 06:12 PooperPig

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

nyabwana avatar Dec 14 '17 11:12 nyabwana

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

oliveirabc avatar Dec 15 '17 11:12 oliveirabc

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

foolOnTheHill avatar Dec 15 '17 13:12 foolOnTheHill

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

worked for me!

belemlc avatar Dec 22 '17 12:12 belemlc

npm i @angular-devkit/[email protected]

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

running these two worked for me..

sanjaynegi avatar Dec 24 '17 17:12 sanjaynegi

把项目的angular版本更新到5.0.0可以彻底解决这个问题。

oldlie avatar Dec 25 '17 06:12 oldlie

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?

simeyla avatar Jan 01 '18 20:01 simeyla

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

simeyla avatar Jan 01 '18 20:01 simeyla

@joseques Thanks. uninstalling the local angular CLI worked.

salmankazmi avatar Jan 04 '18 10:01 salmankazmi

installed latest one and working fine

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

balajidharma avatar Jan 06 '18 19:01 balajidharma

@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

bolajipemipo avatar Jan 09 '18 16:01 bolajipemipo

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

npm remove @angular/cli --save

mohammedshoib avatar Mar 22 '18 23:03 mohammedshoib

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 08 '19 14:10 filipesilva