Closed as not planned
Closed as not planned
Description
Current Behavior
When using any of the nest generators with flag --nameAndDirectoryFormat=as-provided
I am getting below error
NX Cannot read properties of undefined (reading 'text')
Expected Behavior
Must produce expected output and generate requested
GitHub Repo
No response
Steps to Reproduce
- In nx workspace
- Generate a nest js module/controller with below command
npx nx g @nx/nest:module --name {{name_of_module}} --language ts --directory apps/backend/src/app/feature/{{name_of_module}} --nameAndDirectoryFormat=as-provided
Nx Report
Node : 22.8.0
OS : darwin-x64
Native Target : x86_64-macos
npm : 10.8.2
nx : 19.7.4
@nx/js : 19.7.4
@nx/jest : 19.7.4
@nx/linter : 19.7.4
@nx/eslint : 19.7.4
@nx/workspace : 19.7.4
@nx/angular : 19.7.4
@nx/cypress : 19.7.4
@nx/devkit : 19.7.4
@nx/eslint-plugin : 19.7.4
@nx/nest : 19.7.4
@nx/node : 19.7.4
@nrwl/tao : 19.7.4
@nx/web : 19.7.4
@nx/webpack : 19.7.4
typescript : 5.5.4
---------------------------------------
Community plugins:
apollo-angular : 7.0.2
Failure Logs
Even controller generation fails with same errror
*** % npx nx g @nx/nest:controller --name location --module location --language ts --directory apps/server/src/app/feature/location/controller
NX Generating @nx/nest:controller
✔ Where should the controller be generated? · apps/server/src/app/feature/location/controller/location.ts
TypeError: Cannot read properties of undefined (reading 'text')
at createChildren (***/node_modules/typescript/lib/typescript.js:148065:56)
at NodeObject.getChildren (***/node_modules/typescript/lib/typescript.js:148033:83)
at MetadataManager.getSourceNodes (***/node_modules/@nestjs/schematics/dist/utils/metadata.manager.js:65:43)
at MetadataManager.getDecoratorMetadata (***/node_modules/@nestjs/schematics/dist/utils/metadata.manager.js:49:21)
at MetadataManager.insert (***/node_modules/@nestjs/schematics/dist/utils/metadata.manager.js:11:37)
at ModuleMetadataDeclarator.declare (***/node_modules/@nestjs/schematics/dist/utils/module-metadata.declarator.js:8:34)
at ModuleDeclarator.declare (***/node_modules/@nestjs/schematics/dist/utils/module.declarator.js:15:33)
at ***/node_modules/@nestjs/schematics/dist/lib/controller/controller.factory.js:70:51
at callRuleAsync (***/node_modules/@nestjs/schematics/node_modules/@angular-devkit/schematics/src/rules/call.js:77:24)
at ***/node_modules/@nestjs/schematics/node_modules/@angular-devkit/schematics/src/rules/call.js:69:63
NX Cannot read properties of undefined (reading 'text')
Package Manager Version
10.8.2
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
Issue started after upgrading work space to latest version, tried the following
npx nx reset
- Deleted .nx folder
If generator is used without `--nameAndDirectoryFormat=**as-provided**` and derived is used is works
*** % npx nx g @nx/nest:controller --name location --module location --language ts --directory apps/server/src/app/feature/location/controller --nameAndDirectoryFormat=de
rived
NX Generating @nx/nest:controller
In Nx 20, generating a controller will no longer support providing a project and deriving the directory.
Please provide the exact directory in the future.
Example: nx g @nx/nest:controller location --directory apps/server/src/apps/server/src/app/feature/location/controller/location
NOTE: The example above assumes the command is being run from the workspace root. If the command is being run from a subdirectory, the directory option should be adjusted accordingly.
CREATE apps/server/src/apps/server/src/app/feature/location/controller/location/location.controller.spec.ts
CREATE apps/server/src/apps/server/src/app/feature/location/controller/location/location.controller.ts