apollo-angular
apollo-angular copied to clipboard
TypeError: Cannot read properties of undefined (reading 'architect')
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:
- Create a Nx project
- Create an angular application (not sure if this step is needed)
- Run
npm install apollo-angular
- Run
nx g apollo-angular:ng-add
, fill in the questions that appear - 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
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.