saisilinus / node-express-mongoose-typescript-boilerplate

A boilerplate for making production-ready RESTful APIs using Node.js, TypeScript, Express, and Mongoose
MIT License
330 stars 92 forks source link

App crashing at the very beginning. #32

Closed legildas closed 1 year ago

legildas commented 1 year ago

Describe the bug The app crashes when I start it.

To Reproduce Steps to reproduce the behavior:

  1. npx create-nodejs-ts-app back
  2. cd back
  3. yarn dev
  4. See error (screenshot)

Expected behavior The app should work as expected.

Screenshots

Capture d’écran 2022-11-23 à 17 10 34

Desktop :

Additional context This is the same behaviour with yarn start. I also tried to yarn compile first but it didn't change anything.

Thanks for your help !

saisilinus commented 1 year ago

Hey, you are getting the error because you are using Node.js v19.0.1. To enable imports without file extensions, e.g. import app from './app', I used the flag --es-module-specifier-resolution=node when running the app. However, this has been deprecated in the release of Node.js v19 in favor of custom loaders. You can check out the PR here.

I would like to support the previous Node.js versions as well as v19 and will work on this soon. I will appreciate any help on the issue.

I advise you to use a different version of Node.js for now - Node.js 14 to 18 should be okay

legildas commented 1 year ago

Indeed ! It's now working with the LTS version of Node.js (18.12.1). Thanks a lot !

saisilinus commented 1 year ago

Sure :wink: