1
votes

I have created a fresh new asp.net core 2.0 angular project.

I am working on mac os x. I have opened a terminal in project subfolder and typed:

$ npm install

The demo skelton project works fine.

Now i want to work with angular cli.

In my terminal, which is still in project subfolder:

$ npm install -g @angular/cli $ npm install --save-dev @angular/cli

Now, if i move to components subfolder and if i want to generate an angular component:

$ cd ClientApp/app/components/
$ ng g component composant1 

I get this error:

Error: Cannot find module 'rxjs/operators'

Now, on the same computer, if a create a fresh new angular project (without asp.net core):

$ ng new projettemp

My ng g component command works fine in this project.

So i suppose this is an asp.net core issue...

** EDIT **

If i type ng version in my project directory, i get the same error.

If i type ng version outside my project directory, i get 1.6.4

1
which cli version do you use? ng versionzgue
see my edit for this informationBob5421
You need generate a new project before generate a component you can follow the steps from, e.g. dustinewers.com/angular-cli-with-net-coreEliseo
Asp.net also generate à projet ?Bob5421

1 Answers

0
votes

I created a new .net core angular project in Visual Studio and get the same error as you, when trying to create a new component with command $ ng g component composant1.

The angular app in the solution is not created by angular cli, so the .angular.cli.json file is missing. So I tried to create a new angular app as Eliseo recommended in his comment. But same error as with ng g component command.

So I update the dependency for the rxjs library to rxjs": "^5.5.6" in the packages.json file and now the ng g command entry gives the error message

Unable to find any apps in .angular-cli.json.

So angular cli is working again, but you have to update all dependencies in package.json to the newest angular version (in my case it is using an angular version 4) and after that you have to provide a proper .angular-cli.json file for your project structure.