angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ng-serve is not working - Could not find module "@angular-devkit/build-angular"

Open DineshChopra opened this issue 8 years ago • 38 comments

Versions

ng : 6.0.0 node : v8.9.0 npm : 6.0.0 Operating System : macOS

<!--
Output from: `ng --version`.
If nothing, output from: `node --version` and `npm --version`.
  Windows (7/8/10). Linux (incl. distribution). macOS (El Capitan? Sierra?)
-->

Repro steps

  • Step 1
  • Step 2
  • Step 3

I have created new project with angular-cli. ng new testapp cd testapp npm install ng serve

ng serve is not working. I found following error

Could not find module "@angular-devkit/build-angular" from "/Users/dic/workspace/projects/carpool".
Error: Could not find module "@angular-devkit/build-angular" from "/Users/dic/workspace/projects/carpool".
    at Object.resolve (/usr/local/lib/node_modules/@angular/cli/node_modules/@angular-devkit/core/node/resolve.js:141:11)
    at Observable.rxjs_1.Observable [as _subscribe] (/usr/local/lib/node_modules/@angular/cli/node_modules/@angular-devkit/architect/src/architect.js:132:40)
    at Observable.subscribe (/usr/local/lib/node_modules/@angular/cli/node_modules/rxjs/internal/Observable.js:162:69)
    at DoOperator.call (/usr/local/lib/node_modules/@angular/cli/node_modules/rxjs/internal/operators/tap.js:71:23)
    at Observable.subscribe (/usr/local/lib/node_modules/@angular/cli/node_modules/rxjs/internal/Observable.js:159:22)
    at /usr/local/lib/node_modules/@angular/cli/node_modules/rxjs/internal/util/subscribeTo.js:22:31
    at Object.subscribeToResult (/usr/local/lib/node_modules/@angular/cli/node_modules/rxjs/internal/util/subscribeToResult.js:7:45)
    at MergeMapSubscriber._innerSub (/usr/local/lib/node_modules/@angular/cli/node_modules/rxjs/internal/operators/mergeMap.js:132:38)
    at MergeMapSubscriber._tryNext (/usr/local/lib/node_modules/@angular/cli/node_modules/rxjs/internal/operators/mergeMap.js:129:14)
    at MergeMapSubscriber._next (/usr/local/lib/node_modules/@angular/cli/node_modules/rxjs/internal/operators/mergeMap.js:112:18)

[email protected] [~/workspace/projects/carpool]$ ng --version

So request you to please help me to resolve that issue

Observed behavior

<!-- Normally this includes a stack trace and some more information. -->

Desired behavior

Mention any other details that might be useful (optional)

DineshChopra avatar May 05 '18 06:05 DineshChopra

I am having the same issue. when checking my angular cli >ng -v angular-cli

there is packages error, so i do @nanoseconds does

npm unistall -g @angular/[email protected]
npm cache clean --force
npm install -g @angular/[email protected]
npm install node-sass -g

still not working. npm ERR! Unexpected end of JSON input while parsing near '...browserstack-launch er'

NoahStevan avatar Jul 02 '18 08:07 NoahStevan

Thanks npm install @angular-devkit/build-angular but i seem to run into another error

Versions of @angular/compiler-cli and typescript could not be determined. The most common reason for this is a broken npm install.

Please make sure your package.json contains both @angular/compiler-cli and typescript in devDependencies, then delete node_modules and package-lock.json (if you have one) and run npm install again.

Following the instructions in this thread https://github.com/angular/angular-cli/issues/8407

apaluri18 avatar Jul 03 '18 05:07 apaluri18

Thanks its working now.

On Tue, Jul 3, 2018 at 1:23 PM, apaluri18 [email protected] wrote:

Thanks npm install @angular-devkit/build-angular but i seem to run into another error

Versions of @angular/compiler-cli and typescript could not be determined. The most common reason for this is a broken npm install.

Please make sure your package.json contains both @angular/compiler-cli and typescript in devDependencies, then delete node_modules and package-lock.json (if you have one) and run npm install again.

Following the instructions in this thread #8407 https://github.com/angular/angular-cli/issues/8407

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/10661#issuecomment-402016539, or mute the thread https://github.com/notifications/unsubscribe-auth/Amxa8wZoGth7pKBlBaZPdCGguc47Re1Uks5uCv_QgaJpZM4Tzg0v .

NoahStevan avatar Jul 04 '18 05:07 NoahStevan

craviteja's answer worked for me

delete node_modules/ and package-lock.json npm install

all better

Madslick avatar Jul 04 '18 18:07 Madslick

The solution of @ken107 worked for me.

npm i --only=dev

gabrielsodre91 avatar Aug 06 '18 16:08 gabrielsodre91

npm i -D @angular-devkit/core it's work

soheshdoshi avatar Aug 11 '18 06:08 soheshdoshi

Tried all the options but worked only with npm i --only=dev

shubham246 avatar Aug 25 '18 03:08 shubham246

Same prob here tried all the above solution , had to make a new project

Snedden avatar Sep 13 '18 18:09 Snedden

I have issues with ng serve as it returns the following..

Cannot find module '@angular/compiler-cli' Error: Cannot find module '@angular/compiler-cli'.... Then when I do ng version it returns these: Package Version

@angular-devkit/architect 0.10.6 (cli-only) @angular-devkit/build-angular @angular-devkit/core 7.0.6 (cli-only) @angular-devkit/schematics 7.0.6 (cli-only) @angular/cli @angular/compiler-cli @angular/language-service @schematics/angular 7.0.6 (cli-only) @schematics/update 0.10.6 (cli-only) rxjs 6.3.3 typescript 3.1.6 (cli-only)

But my package.json seems do have those: { "name": "testapp", "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": "~7.0.0", "@angular/common": "~7.0.0", "@angular/compiler": "~7.0.0", "@angular/core": "~7.0.0", "@angular/forms": "~7.0.0", "@angular/http": "~7.0.0", "@angular/platform-browser": "~7.0.0", "@angular/platform-browser-dynamic": "~7.0.0", "@angular/router": "~7.0.0", "core-js": "^2.5.4", "rxjs": "~6.3.3", "zone.js": "~0.8.26" }, "devDependencies": { "@angular-devkit/build-angular": "~0.10.0", "@angular/cli": "~7.0.6", "@angular/compiler-cli": "~7.0.0", "@angular/language-service": "~7.0.0", "@types/node": "~8.9.4", "@types/jasmine": "~2.8.8", "@types/jasminewd2": "~2.0.3", "codelyzer": "~4.5.0", "jasmine-core": "~2.99.1", "jasmine-spec-reporter": "~4.2.1", "karma": "~3.0.0", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "~2.0.1", "karma-jasmine": "~1.1.2", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.4.0", "ts-node": "~7.0.0", "tslint": "~5.11.0", "typescript": "~3.1.6" } }

I tried removing package-lock.json and npm install but didn't help. Any idea why those packages have with the version command?

Here's the result for npm install: \testapp> npm install npm WARN deprecated [email protected]: CircularJSON is in maintenance only, flatted is its successor. npm notice created a lockfile as package-lock.json. You should commit this file. audited 39133 packages in 9.165s found 0 vulnerabilities

Addition notes: npm -v (6.4.1) & node -v (v10.13.0)

michaelcmundo avatar Nov 23 '18 16:11 michaelcmundo

I'm also facing the same issue : I installed and started a test app successfully. I git push it from a machine. Then I pulled it on another machine and now this issue occurs.

rahimnagori avatar Feb 09 '19 07:02 rahimnagori

You can go for "npm install" everytime whenever you git pull some another app to your machine as the pushed code on the github is not having node modules.

On Sat, 9 Feb 2019, 12:55 pm Abdul R Nagori, [email protected] wrote:

I'm also facing the same issue : I installed and started a test app successfully. I git push it from a machine. Then I pulled it on another machine and now this issue occurs.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/10661#issuecomment-462021659, or mute the thread https://github.com/notifications/unsubscribe-auth/AlUswsGdBJSYDS4d8M-z1yLaGmAlqnaAks5vLnfSgaJpZM4Tzg0v .

shivymehta98 avatar Feb 10 '19 14:02 shivymehta98

A simple, npm install is what fixed this for me.

jphustman avatar Feb 12 '19 18:02 jphustman

I have the same issue. But i dont know how to fix it.

felix20000 avatar Feb 23 '19 14:02 felix20000

I have the same issue. But i dont know how to fix it.

Did you try the 3 fixes that are mentioned in this threat? I've had this issue with a couple of my projects and for each one the fixes worked.

shervinee avatar Mar 27 '19 23:03 shervinee

npm i --only=dev this worked for me

prashantubale5008 avatar Apr 05 '19 05:04 prashantubale5008

npm cache clean npm install

worked for me

RomanKlimov avatar Apr 14 '19 11:04 RomanKlimov

npm ci

FDiskas avatar May 07 '19 11:05 FDiskas

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.