1

None of the answers here on StackOverflow seemed to help me, maybe because they are all referring to an older version of Angular.

I am a complete newbie trying to start the first Angular project. I did the npm install -g @angular/cli

ng new first-ang cd first-ang But when I do ng serve, it gives me the " Could not find module "@angular-devkit/build-angular" from "D:\Angular\ang". See "C:\Users\Susanna\AppData\Local\Temp\ng-hjBvo0\angular-errors.log" for further details."

The error log contains this:

[error] Error: Could not find module "@angular-devkit/build-angular" from "D:\\Angular\\ang".
    at Object.resolve (C:\Users\Susanna\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\core\node\resolve.js:151:11)
    at WorkspaceNodeModulesArchitectHost.resolveBuilder (C:\Users\Susanna\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js:31:40)
    at ServeCommand.initialize (C:\Users\Susanna\AppData\Roaming\npm\node_modules\@angular\cli\models\architect-command.js:134:55)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:832:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3) 

Here is what the package.json file looks like:

{
  "name": "ang",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~8.2.4",
    "@angular/common": "~8.2.4",
    "@angular/compiler": "~8.2.4",
    "@angular/core": "~8.2.4",
    "@angular/forms": "~8.2.4",
    "@angular/platform-browser": "~8.2.4",
    "@angular/platform-browser-dynamic": "~8.2.4",
    "@angular/router": "~8.2.4",
    "rxjs": "~6.5.3",
    "tslib": "^1.10.0",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.803.3",
    "@angular/cli": "~8.3.3",
    "@angular/compiler-cli": "~8.2.4",
    "@angular/language-service": "~8.2.4",
    "@types/node": "~12.7.4",
    "@types/jasmine": "~3.4.0",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "^5.0.0",
    "jasmine-core": "~3.4.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.0",
    "protractor": "~5.4.0",
    "ts-node": "~8.3.0",
    "tslint": "~5.20.0",
    "typescript": "~3.6.2"
  }
}

I already tried updating npm and doing pretty much everything that has ever been listed on Stackoverlfow, but with no avail. Does anyone know what to do with this latest verison of Angular?

(links to solutions that I've already tried: Could not find module "@angular-devkit/build-angular" Could not find module "@angular-devkit/build-angular" with ng serve ng serve is not working after Angular 8 update )

PS: I noticed my package.json file doesn't have the "angular-cli" dependency. Is this a problem?

4
  • 1
    Have your tried this? Remove 'package-lock.json' and 'node_modules', then redo 'npm install'. Commented Sep 12, 2019 at 18:00
  • i am seeing the cli in the devDependencies "@angular/cli": "~8.3.3". are you installing angular at work? if so you will have to configure the proxy that's what i had to do when i had this issue Commented Sep 12, 2019 at 18:37
  • were there any errors when you initially build the project? Commented Sep 12, 2019 at 18:43
  • @shahidfoy I'm installing at home, could you pleqase tell me what you did with the proxy? :) no but there were some warnings (the project stil got installed) Commented Sep 13, 2019 at 12:50

1 Answer 1

1

Run npm install in the folder that you have packages.json so that all the required packages are restored. (not npm install -g)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.