I'm a little new to Angular, so apologies if this question has been asked many times. Certainly, I have found MANY github issues with similar symptoms, but no clear solution (or it's a problem that keeps coming back).
PROBLEM:
I installed whatever the latest version of Angular comes from npm:
npm install -g @angular/cli
When I run ng (with any options, even if just ng --version), I get the following error:
module.js:540
throw err;
^
Error: Cannot find module '@angular-devkit/core'
at Function.Module._resolveFilename (module.js:538:15)
...
...
APPARENT SOLUTION:
Installing @angular-devkit/core seems to fix the problem:
npm install -g @angular-devkit/core
... well, almost...
I then have to make sure I ALSO install the same devkit component for each application:
npm install --save @angular-devkit/core
QUESTIONS:
Is there a problem with Angular's packaging?
Do they deliberately leave out the devkit/core component, or just an accident with some versions?
OR, Could it be that I am doing something wrong?
SOFTWARE VERSIONS:
- Angular CLI: 1.6.4
- Node: 8.9.4
- OS: linux x64
- Angular: 5.2.1