Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Project '1' could not be found in workspace. #525

Closed
abnersouza opened this issue May 24, 2018 · 12 comments
Closed

Error: Project '1' could not be found in workspace. #525

abnersouza opened this issue May 24, 2018 · 12 comments

Comments

@abnersouza
Copy link

abnersouza commented May 24, 2018

Hey guys, trying to run after the nx update all good, but after trying to run the project i got the following error:

Project '1' could not be found in workspace.
Error: Project '1' could not be found in workspace.
    at Workspace.getProject (/app/node_modules/@angular-devkit/core/src/workspace/workspace.js:83:19)
    at Architect.getBuilderConfiguration (/app/node_modules/@angular-devkit/architect/src/architect.js:96:41)
    at runSingleTarget (/app/node_modules/@angular/cli/models/architect-command.js:123:89)
    at ServeCommand.<anonymous> (/app/node_modules/@angular/cli/models/architect-command.js:131:34)
    at Generator.next (<anonymous>)
    at /app/node_modules/@angular/cli/models/architect-command.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/app/node_modules/@angular/cli/models/architect-command.js:3:12)
    at ServeCommand.runArchitectTarget (/app/node_modules/@angular/cli/models/architect-command.js:121:16)
    at ServeCommand.<anonymous> (/app/node_modules/@angular/cli/commands/serve.js:34:25)

Any idea on how to solve the issue?

Thanks,
Abner

@jschwarty
Copy link
Contributor

@abnersouza What command did you run that resulted in this error? ng serve? And can you provide a repo/example or maybe your angular.json file? Thanks! 😄

@vt5491
Copy link

vt5491 commented May 31, 2018

Same problem. Got around it by specifying the target name on the build command directly and specifying --configuration instead of --environment:

old:
ng serve --environment=my_env --host 0.0.0.0

new:
ng serve myApp --configuration my_env --host 0.0.0.0

Basically, I directly specified my app name 'myApp' directly after 'ng serve'

@vt5491
Copy link

vt5491 commented May 31, 2018

Basically there's a bogus projetctName of '1' in projectNames. I put in some prints in workspace.js:

vturner@vturner-virtual-machine ~/vtstuff/github2/vrgal $ ng serve  --environment=val --host 0.0.0.0 --ssl 1 --ssl-key ~/vtstuff/certs/localhost.key --ssl-cert ~/vtstuff/certs/localhost.crt
vt.workspace.js.getProject: projectName=vrgal
vt.workspace.js.getProject: projectName=vrgal
vt.workspace.js.getProject: projectName=vrgal-e2e
vt.workspace.js.getProject: projectName=1
Project '1' could not be found in workspace.
Error: Project '1' could not be found in workspace.
    at Workspace.getProject (/home/vturner/vtstuff/github2/vrgal/node_modules/@angular-devkit/core/src/workspace/workspace.js:84:19)
    at Architect.getBuilderConfiguration (/home/vturner/vtstuff/github2/vrgal/node_modules/@angular-devkit/architect/src/architect.js:96:41)
    at runSingleTarget (/home/vturner/vtstuff/github2/vrgal/node_modules/@angular/cli/models/architect-command.js:123:89)
    at ServeCommand.<anonymous> (/home/vturner/vtstuff/github2/vrgal/node_modules/@angular/cli/models/architect-command.js:131:34)
    at Generator.next (<anonymous>)
    at /home/vturner/vtstuff/github2/vrgal/node_modules/@angular/cli/models/architect-command.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/home/vturner/vtstuff/github2/vrgal/node_modules/@angular/cli/models/architect-command.js:3:12)
    at ServeCommand.runArchitectTarget (/home/vturner/vtstuff/github2/vrgal/node_modules/@angular/cli/models/architect-command.js:121:16)
    at ServeCommand.<anonymous> (/home/vturner/vtstuff/github2/vrgal/node_modules/@angular/cli/commands/serve.js:34:25)

my angular.json:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "vrgal": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "tsConfig": "src/tsconfig.app.json",
            "polyfills": "src/polyfills.ts",
            "assets": [
              "src/assets",
              "src/favicon.ico",
              "src/.htaccess"
            ],
            "styles": [
              "src/styles.css"
            ],
            "scripts": [
              "src/assets/libs/wasd-plus-controls.js",
              "src/assets/libs/aframe/sticky-state.js",
              "src/assets/libs/aframe/save-state.js",
              "src/assets/libs/aframe/system-base.js",
              "src/assets/libs/aframe/system-utils.js",
              "src/assets/libs/grab-vt.js",
              "src/assets/libs/aframe/hand-controls-vt.js"
            ]
          },
          "configurations": {
            "production": {
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ]
            },
            "sea": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.sea.ts"
                }
              ]
            },
            "val": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.val.ts"
                }
              ]
            },
            "ec2": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.ec2.ts"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "vrgal:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "vrgal:build:production"
            },
            "sea": {
              "browserTarget": "vrgal:build:sea"
            },
            "val": {
              "browserTarget": "vrgal:build:val"
            },
            "ec2": {
              "browserTarget": "vrgal:build:ec2"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "vrgal:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "karmaConfig": "./karma.conf.js",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "scripts": [
              "src/assets/libs/wasd-plus-controls.js",
              "src/assets/libs/aframe/sticky-state.js",
              "src/assets/libs/aframe/save-state.js",
              "src/assets/libs/aframe/system-base.js",
              "src/assets/libs/aframe/system-utils.js",
              "src/assets/libs/grab-vt.js",
              "src/assets/libs/aframe/hand-controls-vt.js"
            ],
            "styles": [
              "src/styles.css"
            ],
            "assets": [
              "src/assets",
              "src/favicon.ico",
              "src/.htaccess"
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "src/tsconfig.app.json",
              "src/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "vrgal-e2e": {
      "root": "",
      "sourceRoot": "",
      "projectType": "application",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "./protractor.conf.js",
            "devServerTarget": "vrgal:serve"
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "e2e/tsconfig.e2e.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "vrgal",
  "schematics": {
    "@schematics/angular:component": {
      "prefix": "app",
      "styleext": "css"
    },
    "@schematics/angular:directive": {
      "prefix": "app"
    }
  }
}

@abnersouza
Copy link
Author

@vt5491 Thanks, I will try do the same in my project.

@vsavkin
Copy link
Member

vsavkin commented Jun 9, 2018

@abnersouza could you provide a repo with a repro?

@vsavkin vsavkin self-assigned this Jun 9, 2018
@abnersouza
Copy link
Author

@vsavkin Unfortunately I decide not to update for the moment, I will try what @vt5491 suggested as soon as I can, many libs we use haven't updated to Angular 6 yet.

@Yonet
Copy link
Contributor

Yonet commented Jun 10, 2018

@abnersouza you can reopen when you can provide a repro. I will close the issue. Thanks!

@Yonet Yonet closed this as completed Jun 10, 2018
@ceccomil
Copy link

... --ssl true ... instead of --ssl 1 should solve the issue.

@abnersouza
Copy link
Author

@ceccomil It really fix the issue thanks a lot, but now i have the issue with command to run
command:
ng serve -a=admin -p=3200 --aot --host 0.0.0.0 --ssl true --ssl-key cert/key.pem --ssl-cert cert/cert.pem

where -a=admin is app name i have three different apps, also is complaining about -p=3000

@ceccomil
Copy link

@abnersouza my guess is, this question it's not related to an issue it's more a request on how to do something... anyway if you run "ng serve --help" you can see the list of available options and change what you need accordingly eg. -p=3200 --port 3200

@jamshed-qureshi-mobinext

I solved it by replacing the project name to the one mentioned in package.json file & it worked for me.

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants