Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@nx/express serve don't works: Only URLs with a scheme in: file and data are supported by the default ESM loader #16839

Closed
1 of 4 tasks
BoobaFetes opened this issue May 7, 2023 · 4 comments
Labels
os: windows Issues that can only be replicated on Windows outdated scope: node Issues related to Node, Express, NestJS support for Nx type: bug

Comments

@BoobaFetes
Copy link

Current Behavior

Behavior

Build a workspace with a client (@nx/react) and a server (@nx/express) like :

npx create-nx-workspace@latest my-app-wksp --pm=yarn --preset=apps  --interactive --no-nxCloud
cd my-app-wksp
yarn add @nx/express @nx/react
yarn nx g @nx/react:application client --tags="client, application" --bundler=webpack --pascalCaseFiles --routing --style="@emotion/styled" --no-strict --e2eTestRunner=none
yarn nx g @nx/express:application server --tags="server, application" --frontendProject client --pascalCaseFiles --unitTestRunner=jest

the workspace is created successfully :

 >  NX   Let's create a new workspace [https://nx.dev/getting-started/intro]
 >  NX   Creating your v16.1.1 workspace.

   To make sure the command works reliably in all environments, and that the preset is applied correctly,
   Nx will run "yarn install" several times. Please wait.

✔ Installing dependencies with yarn
✔ Successfully created the workspace: my-app-wksp.

the client is created successfully
the server is created successfully

When you serve the client with yarn nx serve server, you will read in the terminal the following message and the terminal's execution never ends :

Error: Only URLs with a scheme in: file and data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

Expected Behavior

when workspace , @nx/react:app and @nx/express are created with nx generators, using nx serve on express app should works without error or warning

GitHub Repo

https://github.com/BoobaFetes/nx-issues

Steps to Reproduce

  1. execute the commands :
npx create-nx-workspace@latest my-app-wksp --pm=yarn --preset=apps  --interactive --no-nxCloud
cd my-app-wksp
yarn add @nx/express @nx/react
yarn nx g @nx/react:application client --tags="client, application" --bundler=webpack --pascalCaseFiles --routing --style="@emotion/styled" --no-strict --e2eTestRunner=none
yarn nx g @nx/express:application server --tags="server, application" --frontendProject client --pascalCaseFiles --unitTestRunner=jest
  1. in the workspace folder execute :
yarn nx serve server

Nx Report

>  NX   Report complete - copy this into the issue template

   Node   : 18.16.0
   OS     : win32 x64
   yarn   : 1.22.19
   Hasher : Native

   nx                 : 16.1.1
   @nx/js             : 16.1.1
   @nx/jest           : 16.1.1
   @nx/linter         : 16.1.1
   @nx/workspace      : 16.1.1
   @nx/devkit         : 16.1.1
   @nx/eslint-plugin  : 16.1.1
   @nx/express        : 16.1.1
   @nx/node           : 16.1.1
   @nx/react          : 16.1.1
   @nrwl/tao          : 16.1.1
   @nx/web            : 16.1.1
   @nx/webpack        : 16.1.1
   typescript         : 5.0.4

Failure Logs

$ C:\Users\hyper\source\repos\github\integrate-ia-in-app\my-app-wksp\node_modules\.bin\nx serve server

> nx run server:serve:development

chunk (runtime: main) main.js (main) 831 bytes [entry] [rendered]
webpack compiled successfully (9fbf4029526f14a8)
Debugger listening on ws://localhost:9229/7c4afdba-813b-4954-90ab-76f5952e56db
Debugger listening on ws://localhost:9229/7c4afdba-813b-4954-90ab-76f5952e56db
For help, see: https://nodejs.org/en/docs/inspector
Error: Only URLs with a scheme in: file and data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
    at new NodeError (node:internal/errors:399:5)
    at throwIfUnsupportedURLScheme (node:internal/modules/esm/resolve:1059:11)
    at defaultResolve (node:internal/modules/esm/resolve:1135:3)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ESMLoader.import (node:internal/modules/esm/loader:525:22)
    at importModuleDynamically (node:internal/modules/cjs/loader:1186:29)
    at importModuleDynamicallyWrapper (node:internal/vm/module:429:21)
    at importModuleDynamically (node:internal/vm:106:46)

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

My OS report

Nom de l'appareil Dragon
Processeur 12th Gen Intel(R) Core(TM) i9-12900H 2.50 GHz
Mémoire RAM installée 32,0 Go (31,7 Go utilisable)
Type du système Système d’exploitation 64 bits, processeur x64

Édition Windows 11 Famille
Version 22H2
Installé le ‎13/‎10/‎2022
Build du système d’exploitation 22621.1555
Expérience Windows Feature Experience Pack 1000.22640.1000.0

@AgentEnder AgentEnder added scope: node Issues related to Node, Express, NestJS support for Nx os: windows Issues that can only be replicated on Windows labels May 7, 2023
@justinlettau
Copy link

Same issue with a NestJS application.

@koushiv777
Copy link

Same issue with fastify application also.

@AgentEnder
Copy link
Member

Closing this as a duplicate of #16834

@github-actions
Copy link

github-actions bot commented Jun 8, 2023

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
os: windows Issues that can only be replicated on Windows outdated scope: node Issues related to Node, Express, NestJS support for Nx type: bug
Projects
None yet
Development

No branches or pull requests

4 participants