hello guys I have this next error when I try run my App from the terminal(linux), when I run this command:
ng serve
and I get this error in my terminal:
AppBlog/blog# ng serve
An unhandled exception occurred: Cannot find module '@angular-devkit/build-angular/package.json'
Require stack:
- /usr/local/lib/node_modules/@angular/cli/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js
- /usr/local/lib/node_modules/@angular/cli/node_modules/@angular-devkit/architect/node/index.js
- /usr/local/lib/node_modules/@angular/cli/models/architect-command.js
- /usr/local/lib/node_modules/@angular/cli/commands/serve-impl.js
- /usr/local/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/tools/export-ref.js
- /usr/local/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/tools/index.js
- /usr/local/lib/node_modules/@angular/cli/utilities/json-schema.js
- /usr/local/lib/node_modules/@angular/cli/models/command-runner.js
- /usr/local/lib/node_modules/@angular/cli/lib/cli/index.js
- /usr/local/lib/node_modules/@angular/cli/lib/init.js
- /usr/local/lib/node_modules/@angular/cli/bin/ng
See "/tmp/ng-ev5aDi/angular-errors.log" for further details.
then i checked out this part :
An unhandled exception occurred: Cannot find module '@angular-devkit/build-angular/package.json'
this part say that cannot find moduled called: "'@angular-devkit/build-angular/package.json'"
then I cheked out this file in my project but I have this, look:
"devDependencies": {
"@angular-devkit/build-angular": "~0.900.3",
"@angular/cli": "~9.0.3",
"@angular/compiler-cli": "~9.0.2",
"@angular/language-service": "~9.0.2",
"@types/node": "^12.11.1",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.0",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"protractor": "~5.4.3",
"ts-node": "~8.3.0",
"tslint": "~5.18.0",
"typescript": "~3.7.5"
}
then i went to google and search and I found this like from stackoverflow and I tried their solution but it does not work and I run the command ng serve again.
what I did wrong?
before nothing , before I added 3 components: login,register and home in my folder : src/app with this command : ng generate component login and I import my component in my file : app.component.ts this way:
/* THIS IS JUST A EXAMPLE VERY SIMILAR TO MY CODE REAL, I just import one component*/
import { Component } from '@angular/core';
import { loginComponent } from './login.component';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
declarations: [loginComponent], //import my login
})
export class AppComponent {
title = 'blog';
}
maybe is this part but I dont find a solution, any expert in angular could tell me what I did wrong?
UPDATE
I am continue searching in google and I found this: github/Angular they are saying that I would install npm/angular-cli/node again and I run this command for update my angular cli:
uninstalled ang-cli
npm uninstall @angular/cli
installed the latest
npm install -g @angular/cli@latest
but first I update my npm with this command:
installed the latest npm
npm install -g npm@latest
but it still does not work.