Error when trying to generate new lib using `nx` command
See original GitHub issueCurrent Behavior
Hi folks, ✋
I’m facing a cryptic error when trying to generate new lib in a Nx repository. I’m running the command yarn nx generate lib my-lib which unexpectedly fails and gives the following output:
> NX NOTE Nx didn't recognize the command, forwarding on to the Angular CLI.
You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.
error Command failed with exit code 1.
I tried to directly use the ng command like yarn ng generate lib my-lib and it works well. That’s why I’m opening the issue here.
Expected Behavior
I would like to generate new library using the nx command.
Steps to Reproduce
Simply run yarn nx generate lib my-lib will throw the error. I tried with a fresh new Nx installation and I ran into the same problem.
If you’re willing I can investigate to fix this error.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Newest 'nx-workspace' Questions - Stack Overflow
Nx workspace throws error on creating remote app. As a first command I used to create a host app, by using: nx g...
Read more >nrwl-nx/community - Gitter
Hi, I'm trying to run affected:test but I'm getting errors: NX ERROR Running target "test" for affected projects failed . There is list...
Read more >3 - Generating components and Nx lib - Angular and NgRx
3 - Generating components and Nx lib · Run the below command to see all the lib options · Add a new lib...
Read more >Angular Monorepo Tutorial - Part 1: Code Generation - Nx
In this tutorial you'll create a frontend-focused workspace with Nx. ... Run the command npx create-nx-workspace@latest and when prompted, ...
Read more >What is new in Nx 13.10?
When you set up a new Nx workspace with create-nx-workspace the question ... Lint error about relative import across library boundaries.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi @Edouardbozon - this is down to an incompatibility between your local version of RxJS and the Angular CLI version of RxJS.
Your
package.jsonhas~6.5.0whereas the Angular CLI version you have installed requires6.4.0. This bug only manifests when runningnxbecause then it will use the version of RxJS in yourpackage.jsonnot the internal version that Angular CLI installs.If you downgrade your version of RxJS it will work correctly.
This is fixed with https://github.com/nrwl/nx/pull/2046