diff --git a/packages/angular/src/builders/module-federation-dev-server/module-federation-dev-server.impl.ts b/packages/angular/src/builders/module-federation-dev-server/module-federation-dev-server.impl.ts index 32b89533dcaea..d923b39c89085 100644 --- a/packages/angular/src/builders/module-federation-dev-server/module-federation-dev-server.impl.ts +++ b/packages/angular/src/builders/module-federation-dev-server/module-federation-dev-server.impl.ts @@ -27,7 +27,8 @@ export function executeModuleFederationDevServerBuilder( schema: Schema, context: import('@angular-devkit/architect').BuilderContext ): ReturnType { - const nxBin = require.resolve('nx'); + // Force Node to resolve to look for the nx binary that is inside node_modules + const nxBin = require.resolve('nx/bin/nx'); const { ...options } = schema; const projectGraph = readCachedProjectGraph(); const { projects: workspaceProjects } = diff --git a/packages/react/src/executors/module-federation-dev-server/module-federation-dev-server.impl.ts b/packages/react/src/executors/module-federation-dev-server/module-federation-dev-server.impl.ts index 94d24da7819ae..b8c7ee75e2985 100644 --- a/packages/react/src/executors/module-federation-dev-server/module-federation-dev-server.impl.ts +++ b/packages/react/src/executors/module-federation-dev-server/module-federation-dev-server.impl.ts @@ -40,7 +40,8 @@ export default async function* moduleFederationDevServer( options: ModuleFederationDevServerOptions, context: ExecutorContext ): AsyncIterableIterator<{ success: boolean; baseUrl?: string }> { - const nxBin = require.resolve('nx'); + // Force Node to resolve to look for the nx binary that is inside node_modules + const nxBin = require.resolve('nx/bin/nx'); const currIter = options.static ? fileServerExecutor( {