question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"this.tree.readText is not a function" error after updating nrwl/angular to 14.2.4

See original GitHub issue

After 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

  1. generate nx workspace using npx create-nx-workspace test-workspace
  2. install nrwl Angular dependency npm install -D @nrwl/angular
  3. 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:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

40reactions
tunecinocommented, Jun 24, 2022

Same error here when running a dry run of npx nx generate @nrwl/angular:library.

Nx: 14.4.0-beta.1
Node: 18.4.0
npm: 8.13.1
OS: macOS 11.5.2 arm64 (M1)

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.

0reactions
chioarubcommented, Jun 10, 2022

Removing node_modules and reinstalling got it working. Issue can be closed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

angular/cli reports 'this.tree.readText is not a function' when ...
angular /cli reports 'this. tree. readText is not a function' when trying to generate a new component - Stack Overflow. Stack Overflow for...
Read more >
angular this.tree.readtext is not a function - You.com
ng was exiting unexpectedly with only the message. this.tree.readText is ... readText is not a function" error after updating nrwl/angular to 14.2.4#10678.
Read more >
nrwl-nx/community - Gitter
Hi, I'm trying to run affected:test but I'm getting errors: NX ERROR ... it is some type of logic base on tree dependencies,...
Read more >
ng update で、Migration failed: this.tree.readText is not a ...
readText is not a function が出た時の対応 ng update したら失敗 ➜ portfolio git:(feature/next) ng update @angular/cli@v14.0.0-next.13 ...
Read more >
Automate Updating Dependencies - Nx
Automate Updating Dependencies. The Nx CLI provides the migrate command to help you stay up to date with the latest version of Nx....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found