Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ng g app-shell input.mergeMap is not a function

I am trying to use the latest angular cli to generate a component. I tried to generate a module also I got a similar error.

ng g component testComponent

I got this error

input.mergeMap is not a function
TypeError: input.mergeMap is not a function
    at Object.callRule (C:\Users\dammy\Documents\Visual Studio 2017\Projects\Cars\node_modules\@angular-devkit\schematics\src\rules\call.js:70:18)

my Package.json file looks like this:

{
 ...
  },
  "dependencies": {
    ...
    "css-loader": "0.28.4",
    "es6-shim": "0.35.3",
    "event-source-polyfill": "0.0.9",
    "expose-loader": "0.7.3",
    "extract-text-webpack-plugin": "2.1.2",
    "file-loader": "0.11.2",
    "html-loader": "0.4.5",
    "isomorphic-fetch": "2.2.1",
    "jquery": "3.2.1",
    "json-loader": "0.5.4",
    "preboot": "4.5.2",
    "raw-loader": "0.5.1",
    "reflect-metadata": "0.1.10",
    "rxjs": "5.5.5",
    "style-loader": "0.18.2",
    "to-string-loader": "1.1.5",
    "typescript": "2.4.1",
    "url-loader": "0.5.9",
    "webpack": "2.5.1",
    "webpack-hot-middleware": "2.18.2",
    "webpack-merge": "4.1.0",
    "zone.js": "0.8.12"
  },

I have installed: Angular/[email protected]

like image 705
NetEmmanuel Avatar asked Dec 11 '17 12:12

NetEmmanuel


Video Answer


3 Answers

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 

then install your CLI->

npm install -g @angular/cli@latest 
like image 106
Vijay Chauhan Avatar answered Oct 14 '22 02:10

Vijay Chauhan


For me, i re-installed angular-devkit. Run the command:

npm install @angular-devkit/[email protected] --save-dev

And it worked !

like image 45
Lee Avatar answered Oct 14 '22 03:10

Lee


I had the same issue when upgrading to the @angular/cli 1.6.0 even though I had rxjs v5.5.5. I was able to resolve it by doing the following:

npm i --save-dev @angular/cli@^1.6.0

npm i @angular/cli@^1.6.0 -g

npm i --save-dev typescript@^2.6.2

npm i typescript@^2.6.2 -g

In my case, it was most likely caused by my global typescript not being the same version as my local typescript. I just reinstalled all to make sure everything was in sync [and obviously, you can combine some of these commands, I just posted it like this for clarity].

UPDATE: I had this problem return for some reason and the above solutions didn't work by themselves this time around. After attempting the above, I was able to resolve it by deleting my package-lock.json and local node_modules folder and doing another npm install.

like image 2
MapLion Avatar answered Oct 14 '22 03:10

MapLion