1

I'm trying to restore an old Angular project.

After an npm-install and then ng-serve I get the following error

Could not find API compiler-cli, function __NGTOOLS_PRIVATE_API_2

The error is coming from the @ngtools
package located at ..node_modules\@ngtools\webpack\src\ngtools_api.js:8:11)

my dependencies look as followed

  "dependencies": {
    "@angular/common": "2.0.0",
    "@angular/compiler": "2.0.0",
    "@angular/core": "2.0.0",
    "@angular/forms": "2.0.0",
    "@angular/http": "2.0.0",
    "@angular/platform-browser": "2.0.0",
    "@angular/platform-browser-dynamic": "2.0.0",
    "@angular/router": "3.0.0",
    "angular2-moment": "1.0.0-beta.5",
    "core-js": "^2.4.1",
    "ng2-bootstrap": "^1.1.16",
    "ng2-toastr": "^1.3.0",
    "rxjs": "5.0.1",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.6.23",
    "moment": "2.15.2",
    "karma-phantomjs-launcher": "^1.0.2"
  },
  "devDependencies": {
    "@types/jasmine": "^2.2.30",
    "angular-cli": "1.0.0-beta.16",
    "bootstrap-sass": "^3.3.7",
    "codelyzer": "~0.0.26",
    "jasmine-core": "2.4.1",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-remap-istanbul": "^0.2.1",
    "node-sass": "^3.10.1",
    "protractor": "4.0.14",
    "ts-node": "1.2.1",
    "tslint": "3.13.0",
    "typescript": "2.0.2",
  }

If I delete the nodes module folder I can get the Angluar version from ng -v

angular-cli: 1.0.0-beta.14
node: 9.11.1
os: win32 x64

What would be the best course of action to get this project working again?

georgeawg
  • 48,608
  • 13
  • 72
  • 95
Joshua Duxbury
  • 4,892
  • 4
  • 32
  • 51

4 Answers4

0

There were a few steps involved. I started by upgrading the Angular CLI to a slightly more recent version. I guess just trial and error.

  1. npm install angular-cli@1.0.0-beta.28.3
  2. npm install @angular/core@2.3.1
  3. Fixed an issue with the angular-cli.json outlined here
  4. npm start
Joshua Duxbury
  • 4,892
  • 4
  • 32
  • 51
0

I fixed a similar problem by running this command:

npm i --save-dev @angular/cli @angular-devkit/build-angular @angular/compiler @angular/compiler-cli

Basically, it update all involved actors.

source

aloisdg
  • 22,270
  • 6
  • 85
  • 105
0

Running the below command worked for me as well:

npm i --save-dev @angular/cli @angular-devkit/build-angular @angular/compiler @angular/compiler-cli
pzaenger
  • 11,381
  • 3
  • 45
  • 46
0

I was also coming across this issue. What worked for me in the end was more or less to remove angular cli and re install it with these steps

npm uninstall -g @angular/cli
npm cache clean --force
npm install -g @angular/cli

this helped me out source: how to uninstall angular cli

tony2tones
  • 1,422
  • 1
  • 18
  • 19