"this.tree.readText is not a function" error after updating nrwl/angular to 14.2.4
See original GitHub issueAfter installing “@nrwl/angular”: “^14.2.4” I am not able to use the Nx Console or the CLI to generate Angular applications
Current Behavior
TypeError when generating Angular applications using Cli/NxConsole plugin
Expected Behavior
Generate Angular applications using Cli/NxConsole plugin
Steps to Reproduce
- generate nx workspace using
npx create-nx-workspace test-workspace
- install nrwl Angular dependency
npm install -D @nrwl/angular
- generate Angular application using cli or NxConsole plugin
npx nx generate @nrwl/angular:application web-ui --style=scss --port=4200 --routing --standaloneConfig --no-interactive --dry-run
Failure Logs
run npx nx generate @nrwl/angular:application web-ui --style=scss --port=4200 --routing --standaloneConfig --no-interactive --dry-run
> NX Generating @nrwl/angular:application
TypeError: this.tree.readText is not a function at TreeWorkspaceHost.readFile (D:\Projects\Ts\Personal\test-workspace\node_modules\@schematics\angular\utility\workspace.js:23:26) at readJsonWorkspace (D:\Projects\Ts\Personal\test-workspace\node_modules\@schematics\angular\node_modules\@angular-devkit\core\src\workspace\json\reader.js:17:28) at Object.readWorkspace (D:\Projects\Ts\Personal\test-workspace\node_modules\@schematics\angular\node_modules\@angular-devkit\core\src\workspace\core.js:91:62) at async getWorkspace (D:\Projects\Ts\Personal\test-workspace\node_modules\@schematics\angular\utility\workspace.js:73:27) at async D:\Projects\Ts\Personal\test-workspace\node_modules\@schematics\angular\application\index.js:224:27
this.tree.readText is not a function
Environment
Windows 11 Node : 14.19.3 OS : win32 x64 npm : 6.14.17
nx : 14.2.4 @nrwl/angular : 14.2.4 @nrwl/cypress : 14.2.4 @nrwl/detox : Not Found @nrwl/devkit : 14.2.4 @nrwl/eslint-plugin-nx : Not Found @nrwl/express : Not Found @nrwl/jest : 14.2.4 @nrwl/js : 14.2.4 @nrwl/linter : 14.2.4 @nrwl/nest : 14.2.4 @nrwl/next : Not Found @nrwl/node : 14.2.4 @nrwl/nx-cloud : Not Found @nrwl/nx-plugin : Not Found @nrwl/react : Not Found @nrwl/react-native : Not Found @nrwl/schematics : Not Found @nrwl/storybook : 14.2.4 @nrwl/web : Not Found @nrwl/workspace : 14.2.4 typescript : 4.7.3
Community plugins:
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
Same error here when running a dry run of
npx nx generate @nrwl/angular:library
.Removing node_modules didn’t fix it for me. In my case, the solution was to add
@angular-devkit/schematics
as a dev dependency. That fixed it.Removing node_modules and reinstalling got it working. Issue can be closed.