I have node.js 18.16.0 running on my machine. Configured a new nx workspace with react and later added express. When I serve the react app, it builds fine and launches the app but attempting to serve the express app, the following error is logged:
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)
This may be related to webpack and the way nx configures webpack. Spent countless hours to try resolve it but no luck.
Any alternatives or workaround for this?
@nx/express@16.1.4 @nx/webpack@16.1.4