angular / angular-cli

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

angular9 - ng serve -o - error: An unhandled exception occurred: Project does not exist. #17391

Closed andreElrico closed 4 years ago

andreElrico commented 4 years ago

🐞 Bug report

Command (mark with an x)

Is this a regression?

I just forked a "random" project and updated 8 to 9

Description

🔥 Exception or Error

error for ng serve



An unhandled exception occurred: Project does not exist.
See "/tmp/ng-lZmq9v/angular-errors.log" for further details.

Error log

[error] Error: Project does not exist.
    at WorkspaceNodeModulesArchitectHost.findProjectTarget (//privat/lb-gridstack/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js:122:19)
    at WorkspaceNodeModulesArchitectHost.getOptionsForTarget (//privat/lb-gridstack/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js:73:33)
    at core_1.experimental.jobs.createJobHandler.name (//privat/lb-gridstack/node_modules/@angular-devkit/architect/src/architect.js:171:21)
    at Observable._subscribe (//privat/lb-gridstack/node_modules/@angular-devkit/core/src/experimental/jobs/create-job-handler.js:91:26)
    at Observable._trySubscribe (//privat/lb-gridstack/node_modules/@angular-devkit/core/node_modules/rxjs/internal/Observable.js:44:25)
    at Observable.subscribe (//privat/lb-gridstack/node_modules/@angular-devkit/core/node_modules/rxjs/internal/Observable.js:30:22)
    at Object.subscribeToResult (//privat/lb-gridstack/node_modules/@angular-devkit/core/node_modules/rxjs/internal/util/subscribeToResult.js:12:23)
    at SwitchMapSubscriber._innerSub (//privat/lb-gridstack/node_modules/@angular-devkit/core/node_modules/rxjs/internal/operators/switchMap.js:65:54)
    at SwitchMapSubscriber._next (//privat/lb-gridstack/node_modules/@angular-devkit/core/node_modules/rxjs/internal/operators/switchMap.js:55:14)
    at SwitchMapSubscriber.Subscriber.next (//privat/lb-gridstack/node_modules/@angular-devkit/core/node_modules/rxjs/internal/Subscriber.js:66:18)
    at SwitchMapSubscriber.notifyNext (//privat/lb-gridstack/node_modules/@angular-devkit/core/node_modules/rxjs/internal/operators/switchMap.js:89:26)
    at InnerSubscriber._next (//privat/lb-gridstack/node_modules/@angular-devkit/core/node_modules/rxjs/internal/InnerSubscriber.js:28:21)
    at InnerSubscriber.Subscriber.next (//privat/lb-gridstack/node_modules/@angular-devkit/core/node_modules/rxjs/internal/Subscriber.js:66:18)
    at MapSubscriber._next (//privat/lb-gridstack/node_modules/@angular-devkit/core/node_modules/rxjs/internal/operators/map.js:55:26)
    at MapSubscriber.Subscriber.next (//privat/lb-gridstack/node_modules/@angular-devkit/core/node_modules/rxjs/internal/Subscriber.js:66:18)
    at SwitchMapSubscriber.notifyNext (//privat/lb-gridstack/node_modules/@angular-devkit/core/node_modules/rxjs/internal/operators/switchMap.js:89:26)
    at InnerSubscriber._next (//privat/lb-gridstack/node_modules/@angular-devkit/core/node_modules/rxjs/internal/InnerSubscriber.js:28:21)
    at InnerSubscriber.Subscriber.next (//privat/lb-gridstack/node_modules/@angular-devkit/core/node_modules/rxjs/internal/Subscriber.js:66:18)
    at MapSubscriber._next (//privat/lb-gridstack/node_modules/@angular-devkit/core/node_modules/rxjs/internal/operators/map.js:55:26)
    at MapSubscriber.Subscriber.next (//privat/lb-gridstack/node_modules/@angular-devkit/core/node_modules/rxjs/internal/Subscriber.js:66:18)
    at MergeMapSubscriber.notifyNext (//privat/lb-gridstack/node_modules/@angular-devkit/core/node_modules/rxjs/internal/operators/mergeMap.js:95:26)
    at InnerSubscriber._next (//privat/lb-gridstack/node_modules/@angular-devkit/core/node_modules/rxjs/internal/InnerSubscriber.js:28:21)

🌍 Your Environment


Angular CLI: 9.1.0
Node: 13.8.0
OS: linux x64

Angular: 9.1.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.901.0
@angular-devkit/build-angular      0.901.0
@angular-devkit/build-ng-packagr   0.901.0
@angular-devkit/build-optimizer    0.901.0
@angular-devkit/build-webpack      0.901.0
@angular-devkit/core               9.1.0
@angular-devkit/schematics         9.1.0
@ngtools/webpack                   9.1.0
@schematics/angular                9.1.0
@schematics/update                 0.901.0
ng-packagr                         9.1.0
rxjs                               6.5.5
typescript                         3.8.3
webpack                            4.42.0

package.json


{
  "name": "lb-gridstack",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "copy:readme": "copy .\\README.md .\\projects\\libria\\gridstack\\",
    "build": "ng build",
    "prebuild:lib": "npm run copy:readme",
    "build:lib": "ng build @libria/gridstack",
    "update-version:patch": "cd projects/libria/gridstack && npm version patch",
    "update-version:prerelease": "cd projects/libria/gridstack && npm version prerelease",
    "publish": "npm publish dist/libria/gridstack --access=public",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~9.1.0",
    "@angular/common": "~9.1.0",
    "@angular/compiler": "~9.1.0",
    "@angular/core": "~9.1.0",
    "@angular/forms": "~9.1.0",
    "@angular/platform-browser": "~9.1.0",
    "@angular/platform-browser-dynamic": "~9.1.0",
    "@angular/router": "~9.1.0",
    "rxjs": "^6.5.5",
    "tslib": "^1.10.0",
    "zone.js": "~0.10.2",
    "gridstack": "~0.3.0",
    "jquery": "~2.2.0",
    "jquery-ui-dist": "~1.12.1",
    "lodash": "~4.17.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.901.0",
    "@angular-devkit/build-ng-packagr": "~0.901.0",
    "@angular/cli": "~9.1.0",
    "@angular/compiler-cli": "~9.1.0",
    "@angular/language-service": "~9.1.0",
    "@types/node": "^12.11.1",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/jquery": "^3.2.18",
    "@types/lodash": "^4.14.92",
    "codelyzer": "^5.1.2",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "ng-packagr": "^9.0.0",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.8.3"
  }
}

Anything else relevant?

I looked at: https://github.com/angular/angular-cli/issues/16862

Stuff did not help me.

alan-agius4 commented 4 years ago

Hi, the problem here is that this project contains invalid configuration.

The project listed in the below line lbgridstack doesn't exist. https://github.com/pfms84/lb-gridstack/blob/5d0b2befe9d54dfcb44fc42102313635a313ea4d/angular.json#L77

The correct project name is lb-gridstack.

andreElrico commented 4 years ago

Dude nice spot, I fixed the angular.json and also figured it was sufficient to just call ng serve (because its the default project ?! )

alan-agius4 commented 4 years ago

Yes correct.

angular-automatic-lock-bot[bot] commented 4 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.