Express.js Module Resolution Errors: Missing Internal Modules Not Utilized in Project #6269
Replies: 3 comments
-
Just to confirm, you're using Express with ES modules, in a .js file, and in the package.json you don't have the type set to module? { //package.json
"type": "module"
} note: As far as I know, in the latest version of Node.js 22.12, where CJ modules can be resolved in ES modules, there are issues with libraries that use monkey patching. This will be fixed in the next version of Node.js. I'm on my phone right now, so I can provide links for this later. |
Beta Was this translation helpful? Give feedback.
-
Could you share more context about your project structure and package.json? |
Beta Was this translation helpful? Give feedback.
-
Thank you for providing some insights into the issue. To clarify, I am creating a new boilerplate HTTP server that essentially serves as a "Hello World" application. Here are the details of my setup and the steps I've taken:
Steps Taken So Far:
|
Beta Was this translation helpful? Give feedback.
-
Hello Express Community,
I've been encountering persistent issues with my Express.js application that I haven't been able to resolve despite numerous troubleshooting attempts. Below are the details of the problems and the steps I've taken so far.
Environment:
Node.js Version: v22.12.0
Express.js Version: latest
Operating System: Windows 11
Issues Encountered:
1: Error When Running node index.js:
2: Error When Using Nodemon (npm start):
Steps Taken to Resolve:
Reinstalled node_modules: Deleted the node_modules folder and ran npm install multiple times.
Reinstalled Node.js: Completely removed Node.js and installed the latest version.
Tried Alternative Package Managers: Switched between npm, Yarn, and pnpm without success.
Tested with Other Frameworks: Created simple boilerplate projects using Fastify and NestJS, which run without issues.
Used Different Boilerplates: Even with a fresh Express boilerplate, the same errors persist.
Additional Information:
The issue persists even with a fresh Express setup.
Other Node.js frameworks like Fastify and NestJS work flawlessly on the same environment.
Suspect it might be related to Express's internal modules or compatibility with the current Node.js version.
.
Request for Assistance:
Has anyone encountered similar issues with Express.js, particularly related to missing internal modules like ./middleware/query or brace-expansion? Any insights or suggestions on how to resolve these module resolution errors would be greatly appreciated.
Thank you in advance for your help!
Beta Was this translation helpful? Give feedback.
All reactions