1

After updating node, npm and angular/cli (from angular-cli), I am not able to run an existing project (which is based on angular2). I get the error:

Local workspace file ('angular.json') could not be found.

How I can fix this issue?

Simply renaming angular-cli.json to angular.json did fix the issue but resulted in another error:

Schema validation failed with the following errors: Data path "" should NOT have additional properties(project).

angular-cli.json

{
 "project": {
   "version": "1.0.0-beta.18",
   "name": "client"
 },
 "apps": [
   {
     "root": "src",
     "outDir": "dist",
     "assets": [
       "assets",
       "favicon.ico"
     ],
     "index": "index.html",
     "main": "main-polymer.ts",
     "test": "test.ts",
     "tsconfig": "tsconfig.json",
     "prefix": "app",
     "mobile": false,
     "styles": [
       "main.scss"
     ],
     "scripts": [
       "../node_modules/jquery/dist/jquery.js",
       "../node_modules/signalr/jquery.signalR.js",
       "../node_modules/tether/dist/js/tether.js",
       "../node_modules/chart.js/dist/Chart.bundle.min.js"
     ],
     "environments": {
       "source": "environments/environment.ts",
       "dev": "environments/environment.ts",
       "prod": "environments/environment.prod.ts",
       "tristan": "environments/environment.tristan.ts",
       "azure": "environments/environment.azure.ts",
       "marius": "environments/environment.marius.ts"
     }
   }
 ],
 "addons": [],
 "packages": [],
 "e2e": {
   "protractor": {
     "config": "./protractor.conf.js"
   }
 },
 "test": {
   "karma": {
     "config": "./karma.conf.js"
   }
 },
 "defaults": {
   "styleExt": "scss",
   "prefixInterfaces": false,
   "inline": {
     "style": false,
     "template": false
   },
   "spec": {
     "class": false,
     "component": true,
     "directive": true,
     "module": false,
     "pipe": true,
     "service": true
   }
 }

}

package.json:

{
   "name": "client",
   "version": "0.0.0",
   "license": "MIT",
   "angular-cli": {},
   "scripts": {
      "start": "ng serve",
      "build": "ng build --env=prod",
      "lint": "tslint \"src/**/*.ts\"",
      "test": "ng test",
      "pree2e": "webdriver-manager update",
      "e2e": "protractor"
   },
   "private": true,
   "dependencies": {
   "@angular/common": "~2.1.0",
   "@angular/compiler": "~2.1.0",
   "@angular/core": "~2.1.0",
   "@angular/forms": "~2.1.0",
   "@angular/http": "~2.1.0",
   "@angular/material": "^2.0.0-alpha.10",
   "@angular/platform-browser": "~2.1.0",
   "@angular/platform-browser-dynamic": "~2.1.0",
   "@angular/router": "~3.1.0",
   "@types/hammerjs": "^2.0.33",
   "@types/moment": "^2.13.0",
   "@vaadin/angular2-polymer": "^1.0.0-beta5",
   "angular2-datatable": "^0.5.1",
   "angular2-moment": "^1.0.0-beta.rc.1",
   "bootstrap": "4.0.0-alpha.4",
   "chart.js": "^2.4.0",
   "core-js": "^2.4.1",
   "font-awesome": "^4.7.0",
   "glyphicons-halflings": "1.9.0",
   "hammerjs": "^2.0.8",
   "jquery": "^2.2.4",
   "jwt-decode": "^2.1.0",
   "lodash": "^4.16.6",
   "moment": "^2.15.2",
   "ng2-charts": "^1.4.1",
   "ng2-toastr": "^1.3.0",
   "rxjs": "5.0.0-beta.12",
   "signalr": "^2.2.1",
   "tether": "^1.3.7",
   "ts-helpers": "^1.1.1",
   "zone.js": "^0.6.23"
 },
 "devDependencies": {
   "@angular/cli": "^6.0.3",
   "@types/jasmine": "^2.2.30",
   "@types/lodash": "^4.14.50",
   "@types/moment": "^2.13.0",
   "@types/node": "^6.0.42",
   "@types/selenium-webdriver": "2.53.34",
   "angular-cli": "1.0.0-beta.18",
   "codelyzer": "1.0.0-beta.1",
   "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",
   "protractor": "4.0.9",
   "ts-node": "1.2.1",
   "tslint": "3.13.0",
   "typescript": "~2.0.3"
 } 
}
RobC
  • 22,977
  • 20
  • 73
  • 80
user2074945
  • 537
  • 2
  • 8
  • 22
  • possible duplicate of https://stackoverflow.com/questions/49810580/error-local-workspace-file-angular-json-could-not-be-found – Fateme Fazli May 23 '18 at 11:24
  • Thanks for the comment! While the problem is similar, the given solution does not suit my needs because it requires me to update the project to anguar v5, which is not an option at the moment! – user2074945 May 23 '18 at 11:33
  • install cli v 1.7.4 – David May 23 '18 at 14:24
  • 1
    Possible duplicate of [Error: Local workspace file ('angular.json') could not be found](https://stackoverflow.com/questions/49810580/error-local-workspace-file-angular-json-could-not-be-found) – R. Richards May 23 '18 at 14:32
  • Noticed that you have upgraded your angular cli to version 6.0.3. Since you are using angular version 2.1.0. You should stick to the older version of angular cli v 1.7.4. This should solve your problem. – CostaIvo Jul 22 '18 at 17:55

0 Answers0