Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
61 votes
1 answer
30k views

the difference between nx and Lerna ? (monorepos)

hello i'm in new in monorepos world and i'm now searching about different monorepos tools and i found two intersting tools Nx(nrwl) and lerna but i didn't understand the real differnce between these ...
anis's user avatar
  • 875
22 votes
7 answers
16k views

Global Type Declarations within a NX and NextJS monorepo

I've been looking around the web to try and find s nice solution to my problem but so far I have not. I have a NX monorepo with NextJS and I am trying to create a global types/ folder that can be used ...
lukehillonline's user avatar
17 votes
8 answers
27k views

Nx CLI run many command is not working for multiple apps

I have tried using Nx in an attempt to make use of Monorepos. I have been facing an issue to serve multiple apps via nx run-many command. Can anyone correct me if I'm doing something wrong? Command ...
Chan15's user avatar
  • 999
13 votes
8 answers
13k views

Building library with imports from another library using NX Monorepo

Here is the case. I am using Nrwl NX Monorepo. I have 2 libraries: lib-a and lib-b; both are publishable libraries created via NX. Now I create a MyClass.ts in lib-a. Naturally under paths in ...
Hivaga's user avatar
  • 4,296
12 votes
2 answers
14k views

@nrwl/nx angular Run all test for coverage in a single test run to get all covered code in my mono repo

I'm running tests in multiple projects of my nx angular monorepo and would like to get a single code coverage report of all projects with all code files covert from the tests. The test-runs seems to ...
Richard Liebmann's user avatar
9 votes
1 answer
4k views

Lerna / Nx / Turborepo or other monorepo systems for non-js apps (php)

I have repository with /frontend (JS/Vue) and /backend (PHP) and docker-compose.yml for development. But now I need to add another JS frontend that will be sharing some components, libs etc. I do not ...
norr's user avatar
  • 2,042
9 votes
1 answer
6k views

Nrwl / Nx - how to build single js file consumable by browser with dependencies bundled

I need to build a single js that can be used as Service Worker. I have a nrwl workspace with two @nrwl/web:lib packages, one is common and the other is worker. The worker package uses common through ...
František Žiačik's user avatar
8 votes
2 answers
3k views

How to run NestJs app in Docker using nx/monorepo

I have this Nrwl monorepo with a couple of apps. One of it is a NestJs app, which runs fine as long as I do everything inside my Monorepo. However, I need to run my NestJS app inside a Docker ...
Jeanluca Scaljeri's user avatar
8 votes
1 answer
4k views

How to pass arguments to ng-cli through nx affected:test?

I want to pass some arguments to ng test command when running affected projects (for CI purposes). For example: ng test --codeCoverage=true --watch=false --progress=false. How it can be done through ...
nickbullock's user avatar
  • 6,499
8 votes
4 answers
7k views

NX: How to create a NX workspace in an existing empty git repository instead of creating it under a workspace name?

I have an existing repository. I have cleared all the unwanted files as I wanted to start a new NX-integrated project. But, I want to continue using the same repository as there are some files which I ...
shet_tayyy's user avatar
  • 5,665
7 votes
1 answer
2k views

Angular console log source is always instrument.js

I'm now running Angular 12.1.0 in NX Monorepo in latest version 12.6.5. For a long time (not just with the last version) I noticed the console logs from angular components in my system are marked as ...
George Knap's user avatar
  • 1,110
7 votes
4 answers
21k views

How to change the ts path aliases for an nx application

I am importing an existing application into an NX monorepo with a file structure a little different from default apps. It looks like this: apps my-app src feature-1 feature-2 ...
plusheen's user avatar
  • 1,364
7 votes
2 answers
5k views

NX Error for Relative Imports within the Same Project

I'm getting an error when using TS aliased paths within the same project: Projects should use relative imports to import from other files within the same project I don't want this behavior. Any idea ...
S. C.'s user avatar
  • 187
7 votes
1 answer
4k views

How to import absolute paths in a @nrwl/nx monorepo?

I'm working on a @nrwl/nx monorepo. I want to import the folders inside the project src by the absolute paths. I tried specifying the baseUrl but didn't work. The only solution worked is, adding the ...
Sennen Randika's user avatar
7 votes
0 answers
2k views

how can i use absolute paths in same library in NX monorepo

I am working on Nx monorepo. We have 5 library and are using imports like this '../../components/Button' in library. but instead of this, we want to use absolute imports. For example: there are 2 ...
efdali's user avatar
  • 71
6 votes
2 answers
9k views

How to share SASS styles between libs inside my NX monorepo?

I'm trying to build a component library for angular and react. That's why I want to use the same styles(sass) for both libs. I created a separate folder for my styles and included my main sass inside ...
Safiul islam's user avatar
6 votes
2 answers
9k views

Nrwl Nx and monorepo - handle package.json for particular apps

for a frontend architecture I'm evaluating the usage of monorepo with Nrwl Nx. I understood from the docs that Nx strongly recommends the single-policy for dependencies (a root package.json with all ...
diego.gazzola's user avatar
6 votes
0 answers
1k views

How to include 3rd party dependencies in Nx library

New to Nx and not sure yet when it makes sense to extract code into libraries... Is it possible/does it make sense to build an Nx library using a 3rd party dependency (let's say angular material) and ...
Patric's user avatar
  • 1,549
5 votes
3 answers
7k views

Nx shared asset library

I want my React app in my Nx monorepo to retrieve all the assets in my asset library called common-assets. I managed to do it with my NextJS app like so : project.json of my NextJS app { "$...
Louis Lecouturier's user avatar
5 votes
0 answers
491 views

How to manage databases in a NX workspace

What is the best practice for managing databases in NX? I am using Knex migrations to manage the schema of a database and would like to add this to the NX monorepo to simplify development, deployment, ...
Jonah's user avatar
  • 111
4 votes
1 answer
6k views

Creating NX Monorepo with concrete (older) Angular version

Generating NX Monorepo Workspace (https://nx.dev/) is straight forward here the steps: npx create-nx-workspace (to create empty workspace) yarn add -D @nrwl/angular (to add nx's angular plugin/...
Hivaga's user avatar
  • 4,296
4 votes
2 answers
4k views

Can i update my monorepo nx workspace without upgrading angular version?

Want to move from nx 10 workspace to 12 without moving away from angular 10. nx migrate latest however upgrade also upgrade angular by default. I searched https://nx.dev/previous/angular/core-concepts/...
Magnum23's user avatar
  • 417
4 votes
1 answer
2k views

Nx Angular - no such file or directory, open 'd:\...\TheApp\Source\Angular.Apps/apps/app-client/src/environments/environment.prod.ts'

I've spent some time working on a PowerShell project to automate some builds of my C# and Angular apps which are based on @Nrwl NX monorepos. Prior to this everything worked fine, but when I try a ...
Jacques's user avatar
  • 7,065
3 votes
1 answer
3k views

Nx print a list of affected projects

I see that Nx is deprecating the print-affected command. The alternatives given does not produce the output I want. Right now, I am using nx print-affected --target=<script name> which tells me ...
puter's user avatar
  • 161
3 votes
1 answer
3k views

nx build command failed with TypeError: Cannot read properties of undefined (reading 'cloud')

I am trying to run nx build it was working fine, but now it stopped working. below are the logs /vercel/path0/node_modules/@nrwl/nx-cloud/lib/nx-cloud-tasks-runner.js:20 const noCloud = nxArgs['...
Vivek Maru's user avatar
  • 8,499
3 votes
1 answer
1k views

NX one Ui-lib or create a lib for each Ui usecase

So I want to create shared libs in my angular project. I have listed down below my two approaches, which both do their job, but I don't which is the better one, that I should implement. #1 One Ui lib ...
dewey's user avatar
  • 979
3 votes
1 answer
3k views

Nrwl Nx build node project only transpiles main.ts

I'm new to Nrwl and monorepos. I have a node app which I'm trying to build using nx build [project-name]. My node app has a handful of typescript files in a folder structure under the src folder ...
Tom Schreck's user avatar
  • 5,237
3 votes
1 answer
991 views

nrwl NX , angular , nest project, how to make PWA for a specific angular app

I am building a monorepo using NX nrwl. I have an angular front end and a nestjs backend in the same repository.. To make the angular project to PWA, there is command with ng-add, but that doesn't ...
Jay's user avatar
  • 386
3 votes
1 answer
2k views

Share redux state among workspaces or libraries inside a monorepo

I’m recently having a hard time to understand how to manage some logic between shared apps and libs, in particular with redux setted up in the main app and the need to use it on the shared-ui ...
Santiago's user avatar
  • 422
3 votes
0 answers
303 views

How can I fix the 'Cannot find module' error with a package in an NX monorepo using ts-node?

I'm currently trying to get a NX monorepo to properly build my project. I'm using ts-node to compile / create an admin-ui directory. The project.json target for it looks like this: "targets:"...
Stefan's user avatar
  • 93
3 votes
0 answers
681 views

Using icons from NX shares assets lib in project's styles url attribute value

In my monorepo I implemented NX shared assets library for storing icons. This lib can be used across multiple applications inside this monorepo. This mentioned librabry contains set of svg icons and ...
Daniel Dvonč's user avatar
3 votes
0 answers
219 views

What is the best way to import CRA project into existing Nx v15 monorepo?

Previously I asked about the migration of the Create-React-App project in the case of Nx v14.x.x. For that version of Nx, there was an algorithm for manual migration. Now there is only an automated ...
Vladislav Maksimov's user avatar
3 votes
0 answers
3k views

Nx - how to import from another module when building with the tsc executor?

I have a problem that is similar to the one described in Building library with imports from another library using NX Monorepo. Using nx monorepo with a node app and a library. The app is built with @...
falconizer's user avatar
3 votes
0 answers
419 views

Branch and Release flow for distributed teams in a Monorepo

We are trying to move 3 angular apps(using NX workspace) from their own repo to a single repository/monorepo because they can share lot of code and assets from common libs, currently all these apps ...
user1264429's user avatar
3 votes
1 answer
6k views

How to make a buildable publishable library with Nx that is framework agnostic for browser and node.js

I have a monorepo (Nx Workspace) that has many libraries that were generated with @nrwl/js. These libraries depend on each other. They are small utility libraries that I intend to publish on NPM as ...
snowfrogdev's user avatar
  • 6,703
2 votes
3 answers
9k views

Nx missing dependencies on generated package.json

I've setup a basic publishable lib using @nrwl/react: nx g @nrwl/react:lib my-new-lib --publishable --importPath=@myorg/my-new-lib Then installed MUI in the monorepo root: npm install @mui/material @...
Camilo's user avatar
  • 7,013
2 votes
1 answer
6k views

Problem with launching application in NX monorepo: (cannot read undefined (reading 'projects')

I had one project (grocery-shop) in NX monorepo that uses nestjs among others. The application is a strict backend api. I wanted to add a frontend and for this purpose I dragged react to the project. ...
displaynone's user avatar
2 votes
1 answer
4k views

NX how to pass arguments to target dependency

I have the project config set in the package.json as below: "nx": { "targets": { "build": { "outputs": [ "{projectRoot}/dist" ...
puter's user avatar
  • 161
2 votes
1 answer
2k views

Could not find bootstrapApplication call in apps/product/src/main.ts while adding @angular/material with Nrwl Nx Mfa Workspace

I have created a project with the Nx Mfa schema as follows npx create-nx-workspace fetebird --preset=empty npm install --save-dev @nrwl/angular nx g @nrwl/angular:host host --remotes=product,...
San Jaisy's user avatar
  • 16.4k
2 votes
1 answer
2k views

NX Monorepo (14.3.6) no support for $localize (Angular localize)

Here is the case I have installed latest version of nx monorepo (npx create-nx-workspace@latest). Currently latest version of nx is (14.3.6). After this I have added angular localization package (npm ...
Hivaga's user avatar
  • 4,296
2 votes
1 answer
1k views

Cannot use TypeOrm in nx-nestjs project: ERR_REQUIRE_ESM

I am migrating my NestJS-TypeOrm app to a monorepo (NX workspace). Whenever I try to run the app, I get this error: C:\myproject\node_modules\@nrwl\node\src\executors\node\node-with-require-overrides....
Patric's user avatar
  • 1,549
2 votes
1 answer
636 views

What is the problem of incompatibility of library versions and how monorepo-style solve it?

I started to interest in monorepo approach and Nx.js in particularly. Almost all articles talks that monorepo solve the problem of incompatibility of library versions and I don't quite understand the ...
Serafim's user avatar
  • 25
2 votes
1 answer
4k views

NX package-based repo: projectRoot vs workspaceRoot?

If I have a package-based monorepo with NX, which directory is projectRoot, and which one is workspaceRoot? From the docs (https://nx.dev/reference/project-configuration): {projectRoot} and {...
scriptin's user avatar
  • 3,090
2 votes
1 answer
107 views

How to change text in the component base on the project I runs?

I build auth lib in my nx monorepo. The auth lib contains LoginComponent (smart) and LoginFormComponent (dumb). And I load the lib as lazy by using loadChildren to load auth.module and inside this ...
Jon Sud's user avatar
  • 11.3k
2 votes
3 answers
549 views

Getting Error : NX Failed to create directory: /app/node_modules/.cache/nx while creating Docker Image

I was trying to dockerize the monorepo with NX, NEXTJS and "NESTJS app, Tried the below Dockerfile.frontend - # Install deps and build the source code only when needed FROM node:lts-alpine AS ...
CandleCoder's user avatar
  • 1,467
2 votes
2 answers
2k views

Setup react-i18next with NX Monorepo

I trying to set up i18next inside a monorepo using NX and Module Federation and I'm getting 404, I'm using i18next-http-backend to load the translations async. I've tried to put public/locales/en/...
niltonxp's user avatar
  • 410
2 votes
1 answer
762 views

I want my nx monorep to allow css and sass styling?

I created an nx workspace and added CSS for styling but my project also uses SCSS files. How can I tell my nx workspace to accept SCSS files? Is there a command I can run?
codythedev's user avatar
2 votes
0 answers
91 views

NX ENOENT: no such file or directory, scandir ''

I use an NX monorepo, and I would like to build my frontend app. I get the following error: NX ENOENT: no such file or directory, scandir ''. I found some similar questions, but mine differs, as ...
nabsabt's user avatar
  • 47
2 votes
0 answers
362 views

How to change tsconfig.json inside NX Vite library/app builds

Have someone found a way to customise the tsconfig.json for NX project build. When using Vite as bundler? Here is the problem below is a standart NX(18.0.4) vite.config.ts for library. When you do 'nx ...
Hivaga's user avatar
  • 4,296
2 votes
2 answers
3k views

How to find and resolve CD (Circular Dependencies) in NX, React?

I've been working on a Monorepo and apps folder containing 3 projects: admin commerce vendor Beside apps folder, there is libs folder which contains separate folders such as components and etc. I ...
Ali Bahaari's user avatar