angular-cli: ng g input.mergeMap is not a function
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 ]
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 21
- Comments: 41 (2 by maintainers)
Commits related to this issue
- fix: angular-cli generate command Can be reverted once https://github.com/angular/angular-cli/issues/8782 is fixed. — committed to ryzy/what-conference-next by ryzy 7 years ago
I was able to fix installing this locally
@angular-devkit/schematics@0.0.40
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 withnpm remove @angular/cli --save
in my project folder.rm package-lock.json
npm install @angular-devkit/schematics@0.0.34 --save-dev
worked for me!
Same happens with
ng g component [componentname]
orng g module [modulename]
yarn install
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.
upgraded below packages and it started working again.’
After upgrading from 4 to 5, I had to delete package-lock.json and run npm install - that fixed the problem.
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
Installing rxjs@^5.5.5 on angular/cli worked for me.
Had same problem. Tried all recommendations above. Only deleting node_modules and package-lock.json worked out.
Installing @angular-devkit/schematics@0.0.40 seems to have solved the problem for me. Worked like magic
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
andnpm i typescript@latest -g
as some others mentioned above.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