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.

Error when trying to generate new lib using `nx` command

See original GitHub issue

Current 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:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
jdpearcecommented, Nov 7, 2019

Hi @Edouardbozon - this is down to an incompatibility between your local version of RxJS and the Angular CLI version of RxJS.

Your package.json has ~6.5.0 whereas the Angular CLI version you have installed requires 6.4.0. This bug only manifests when running nx because then it will use the version of RxJS in your package.json not the internal version that Angular CLI installs.

If you downgrade your version of RxJS it will work correctly.

0reactions
FrozenPandazcommented, Dec 6, 2019
Read more comments on GitHub >

github_iconTop 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 >

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