angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.73k stars 11.98k forks source link

angular/cli will not "serve" or start default project gives Error: The "@angular/compiler-cli" package was not properly installed. ... at Object.<anonymous>... index.js:14:11) #7070

Closed rberge closed 7 years ago

rberge commented 7 years ago

Bug Report or Feature Request (mark with an x)

- [ x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

Notes: This happened as soon as I installed angular/cli. But I installed it a few days ago, ran through all the online reports and tried most if not all of the steps to fix similar issues. Then I deinstalled angular/cli and reinstalled it. Additionally in previous deinstalls I had opened an Windows Explorer session and searched for node_modules and then selected and deleted all global folders. I tried doing a local install first but found that this doesn't create a path so the ng command didn't work (although npm list showed it had installed). I then tried a local deinstall like this: C:\AngularServiceTest1>npm uninstall angular/cli. I don't recall and didn't save the response. This particular problem then happened after I subsequently did a global install just like it shows in the documentation. I did the install from the C:\ drive prompt (which nowhere shows in documentation by the way and would be greatly appreciated). This install has each time put the node modules into my AppData/Roaming section (not listing all the folders).

Repro steps.

The log given by the failure.

I can't find a log. There is no node_modules directory in this project. Directory of C:\my-dream-app

07/20/2017 08:39 AM

. 07/20/2017 08:39 AM .. 07/20/2017 08:39 AM 1,130 .angular-cli.json 07/20/2017 08:39 AM 245 .editorconfig 07/20/2017 08:39 AM 516 .gitignore 07/20/2017 08:39 AM e2e 07/20/2017 08:39 AM 924 karma.conf.js 07/20/2017 08:39 AM 1,316 package.json 07/20/2017 08:39 AM 722 protractor.conf.js 07/20/2017 08:39 AM 1,080 README.md 07/20/2017 08:39 AM src 07/20/2017 08:39 AM 363 tsconfig.json 07/20/2017 08:39 AM 3,040 tslint.json 9 File(s) 9,336 bytes 4 Dir(s) 55,770,427,392 bytes free

Contents of package.json file { "name": "my-dream-app", "version": "0.0.0", "license": "MIT", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/animations": "^4.0.0", "@angular/common": "^4.0.0", "@angular/compiler": "^4.0.0", "@angular/core": "^4.0.0", "@angular/forms": "^4.0.0", "@angular/http": "^4.0.0", "@angular/platform-browser": "^4.0.0", "@angular/platform-browser-dynamic": "^4.0.0", "@angular/router": "^4.0.0", "core-js": "^2.4.1", "rxjs": "^5.1.0", "zone.js": "^0.8.4" }, "devDependencies": { "@angular/cli": "1.2.1", "@angular/compiler-cli": "^4.0.0", "@angular/language-service": "^4.0.0", "@types/jasmine": "~2.5.53", "@types/jasminewd2": "~2.0.2", "@types/node": "~6.0.60", "codelyzer": "~3.0.1", "jasmine-core": "~2.6.2", "jasmine-spec-reporter": "~4.1.0", "karma": "~1.7.0", "karma-chrome-launcher": "~2.1.1", "karma-cli": "~1.0.1", "karma-coverage-istanbul-reporter": "^1.2.1", "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.1.2", "ts-node": "~3.0.4", "tslint": "~5.3.2", "typescript": "~2.3.3" } }

The index.js file lines 10-15 try { version = require('@angular/compiler-cli').VERSION; } catch (e) { throw new Error('The "@angular/compiler-cli" package was not properly installed.'); }

Desired functionality.

I would like to be able to use angular/cli which means serving or starting the project (I also tried start C:\my-dream-app>ng start The specified command start is invalid. For available options, see ng help.)

I expect that the default application would start up and display some default text (name of project for example). This same error happens with projects that i have edited...

The code appears to be telling me that the dependency set up for the version of cli is wrong but I don't see what it wants.

Mention any other details that might be useful.

rberge commented 7 years ago

Note this stack overflow issue about the same or similar thing https://stackoverflow.com/questions/42925690/angular2-cli-error-angular-compiler-cli-package-was-not-properly-installed It has many answers and I have tried most of them.

filipesilva commented 7 years ago

You mentioned There is no node_modules directory in this project.. I think that's your problem. Do npm install in C:\my-dream-app and you should be fine. Also there is no ng start command, it's ng serve.

angular-automatic-lock-bot[bot] commented 5 years ago

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.