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

TypeError: Cannot read properties of undefined (reading 'architect') #2046

Open
chriswoodie opened this issue Jul 3, 2023 · 1 comment
Open

Comments

@chriswoodie
Copy link

Describe the bug
Running nx g apollo-angular:ng-add results in the following error after providing graphql api url and graphql version:

TypeError: Cannot read properties of undefined (reading 'architect')
    at getMainPath (/Users/myuser/Documents/foo/node_modules/apollo-angular/schematics/utils/project.js:10:21)

To Reproduce

Steps to reproduce the behavior:

  1. Create a Nx project
  2. Create an angular application (not sure if this step is needed)
  3. Run npm install apollo-angular
  4. Run nx g apollo-angular:ng-add, fill in the questions that appear
  5. See error

Expected behavior

Not an error to be thrown.

Environment:

├── @angular/[email protected]
├── @angular/[email protected]
├── @apollo/[email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Additional context

None

@Kaemmelot
Copy link

The problem seems to be in multi-project angular applications. In this line the defaultProject is undefined because it was deprecated quite some time ago and is now finally removed via migrations.
So the default project should be determined based on the working directory and not based on the angular.json file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants