Reputation:
I developed an application ( angular2 nodejs), but now when I open it, I get the following error:
The serve command requires to be run in an Angular project, but a project definition could not be found.
I do not find the problem knowing that I made an update to the cli
*Angular CLI: 7.0.4
Node: 10.6.0
OS: win32 x64
Angular: 2.4.10
... common, compiler, compiler-cli, core, forms, http
... platform-browser, platform-browser-dynamic
Package Version
------------------------------------------------------
@angular-devkit/architect <error>
@angular-devkit/core <error>
@angular-devkit/schematics <error>
@angular/router 3.4.10
@angular/tsc-wrapped 0.5.2
@ngtools/json-schema 1.1.0
@ngtools/webpack 1.10.2
@schematics/angular <error>
@schematics/update <error>
rxjs 5.5.11
typescript 2.0.10
webpack 2.2.0*
this is my .json package
{
"name": "angular-src",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"ng": "ng",
"start": "ng serve",
"test": "ng test",
"pree2e": "webdriver-manager update --standalone false --gecko false",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular/common": "^2.3.1",
"@angular/compiler": "^2.3.1",
"@angular/core": "^2.3.1",
"@angular/forms": "^2.3.1",
"@angular/http": "^2.3.1",
"@angular/platform-browser": "^2.3.1",
"@angular/platform-browser-dynamic": "^2.3.1",
"@angular/router": "^3.3.1",
"angular2-flash-messages": "^1.0.8",
"angular2-jwt": "^0.2.3",
"bootstrap": "^4.1.3",
"core-js": "^2.4.1",
"rxjs": "^5.0.1",
"ts-helpers": "^1.1.1",
"zone.js": "^0.7.2"
},
"devDependencies": {
"@angular/compiler-cli": "^2.3.1",
"@types/jasmine": "2.5.38",
"@types/node": "^6.0.42",
"angular-cli": "1.0.0-beta.28.3",
"codelyzer": "~2.0.0-beta.1",
"jasmine-core": "2.5.2",
"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.13",
"ts-node": "1.2.1",
"tslint": "^4.3.0",
"typescript": "~2.0.3"
}
}
Upvotes: 3
Views: 13050
Reputation: 1728
Here are some tips that might be useful for this case:
ng serve
npm install
npm start
Upvotes: 0
Reputation: 771
This worked for me, delete or rename 'angular.json' then create a new one.
ng update @angular/cli
You may also need up update typescript if you get error.
Also follow the step here: https://update.angular.io/
Upvotes: 1