Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am new to angular 6 I have downloaded the ready-made angular template from link

Navigated to root folder & Executed npm install trying to run the application ng serve but it's showing error

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

package.json

{
  "name": "angular-6-registration-login-example",
  "version": "1.0.0",
  "repository": {
    "type": "git",
    "url": "https://github.com/cornflourblue/angular-6-registration-login-example.git"
  },
  "scripts": {
    "build": "webpack --mode production",
    "start": "webpack-dev-server --mode development --open"
  },
  "license": "MIT",
  "dependencies": {
    "@angular/common": "^6.0.0",
    "@angular/compiler": "^6.0.0",
    "@angular/core": "^6.0.0",
    "@angular/forms": "^6.0.0",
    "@angular/platform-browser": "^6.0.0",
    "@angular/platform-browser-dynamic": "^6.0.0",
    "@angular/router": "^6.0.0",
    "core-js": "^2.5.5",
    "rxjs": "^6.1.0",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@types/node": "^10.0.4",
    "angular2-template-loader": "^0.6.2",
    "html-webpack-plugin": "^3.2.0",
    "raw-loader": "^0.5.1",
    "ts-loader": "^4.3.0",
    "typescript": "^2.8.3",
    "webpack": "4.8.1",
    "webpack-cli": "^2.1.3",
    "webpack-dev-server": "3.1.4"
  }
}

My environment configuration is,

Angular CLI: 6.0.3
Node: 8.11.2
OS: linux x64
Angular: 6.0.3
... common, compiler, core, forms, platform-browser
... platform-browser-dynamic, router

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.6.3 (cli-only)
@angular-devkit/core         0.6.3 (cli-only)
@angular-devkit/schematics   0.6.3 (cli-only)
@schematics/angular          0.6.3 (cli-only)
@schematics/update           0.6.3 (cli-only)
rxjs                         6.2.0
typescript                   2.8.4
webpack                      4.8.1

Please help me to address this issue.

like image 414
rahul shalgar Avatar asked May 31 '18 19:05

rahul shalgar


1 Answers

Since your Project Does not use Angular-CLI you cannot execute ng serve which resulted in the error because ng serve looks out for this configuration file to kickstart your app

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

it uses webpack and all the webpack configuration is stored in webpack.config.js.
if you observe your package.json you could see under script section start and build

"scripts": {
    "build": "webpack --mode production",
    "start": "webpack-dev-server --mode development --open"
  },

you can execute these scripts using npm
Execute npm run start for devlopment build

like image 108
Vikas Avatar answered Nov 08 '22 21:11

Vikas