Closed lucas-labs closed 1 year ago
I am getting the same error while trying to serve my Nest app after upgrading Nx from v16.1.0
to v16.1.1
. I have tried this on both Node v18 and Node v20 and the issue occurs on both. Reverting to v16.1.0
resolves the issue.
Node : 20.1.0
OS : win32 x64
pnpm : 8.3.1
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/angular : 16.1.1
@nx/cypress : 16.1.1
@nx/devkit : 16.1.1
@nx/eslint-plugin : 16.1.1
@nx/nest : 16.1.1
@nx/node : 16.1.1
@nx/storybook : 16.1.1
@nrwl/tao : 16.1.1
@nx/webpack : 16.1.1
typescript : 5.0.4
---------------------------------------
Community plugins:
@storybook/angular : 7.0.9
apollo-angular : 4.2.1
Same problem on windows 11
Same for macOS
> nx run express:serve:development
> NX Cannot find module 'ajv/dist/compile/codegen'
Require stack:
- /Users/kennethwarren/Desktop/wmfg/node_modules/ajv-keywords/dist/definitions/typeof.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/ajv-keywords/dist/keywords/typeof.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/ajv-keywords/dist/keywords/index.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/ajv-keywords/dist/index.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/schema-utils/dist/validate.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/schema-utils/dist/index.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/copy-webpack-plugin/dist/index.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/@nx/webpack/src/utils/create-copy-plugin.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/@nx/webpack/src/utils/with-nx.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/@nx/webpack/src/executors/webpack/lib/get-webpack-config.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/@nx/webpack/src/executors/webpack/webpack.impl.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/nx/src/config/workspaces.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/nx/src/command-line/run.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/nx/bin/run-executor.js
Error: Cannot find module 'ajv/dist/compile/codegen'
Require stack:
- /Users/kennethwarren/Desktop/wmfg/node_modules/ajv-keywords/dist/definitions/typeof.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/ajv-keywords/dist/keywords/typeof.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/ajv-keywords/dist/keywords/index.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/ajv-keywords/dist/index.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/schema-utils/dist/validate.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/schema-utils/dist/index.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/copy-webpack-plugin/dist/index.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/@nx/webpack/src/utils/create-copy-plugin.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/@nx/webpack/src/utils/with-nx.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/@nx/webpack/src/executors/webpack/lib/get-webpack-config.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/@nx/webpack/src/executors/webpack/webpack.impl.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/nx/src/config/workspaces.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/nx/src/command-line/run.js
- /Users/kennethwarren/Desktop/wmfg/node_modules/nx/bin/run-executor.js
at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
at Module._load (node:internal/modules/cjs/loader:841:27)
at Module.require (node:internal/modules/cjs/loader:1061:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (/Users/kennethwarren/Desktop/wmfg/node_modules/ajv-keywords/dist/definitions/typeof.js:3:19)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Module.require (node:internal/modules/cjs/loader:1061:19)
> NX Running target serve for project express failed
@lucas-labs I have the same issue. I tried downgrading all versions to 16.0.3 and it worked. https://github.com/nrwl/nx/issues/16834#issuecomment-1537154263
I have the same problem serving nestjs app
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)
##Nx Report
Node : 18.16.0
OS : win32 x64 npm : 9.5.1 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/nest : 16.1.1 @nx/node : 16.1.1 @nrwl/tao : 16.1.1 @nx/webpack : 16.1.1 nx-cloud : 16.0.5 typescript : 5.0.4
I'm closing this as a duplicate of #16834
Same for macOS
Seems like a different problem, you probably need to npm install
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.
Current Behavior
Expected Behavior
It should serve the app
GitHub Repo
https://github.com/lucas-labs/nx-issue-repro
Steps to Reproduce
Create the workspace selecting node-standalone - fastify
√ Choose what to create · node-standalone √ Application name · repro √ What framework should be used? · fastify √ Would you like to generate a Dockerfile? [https://docs.docker.com/] · No √ Enable distributed caching to make your CI faster · No
Failure Logs
Operating System
Additional Information
Searching old issues I found that a similar error happened with Node < v14. Tried with node versions: 20.1.0, 20.0.0, 18.16.0 and 16.14.0 and got the same error message.