nestjs / nest

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
https://nestjs.com
MIT License
67.69k stars 7.63k forks source link

New TS project hot reloading does not work #3056

Closed mdurakovic closed 5 years ago

mdurakovic commented 5 years ago

Bug Report

Current behavior

Hot reloading does not work

Input Code

Followed instructions to setup new TS starter project

$ git clone https://github.com/nestjs/typescript-starter.git myProject
$ cd project
$ npm install
$ npm run start:dev

Expected behavior

Expecting hot reloading to work properly. Change "Hello world" in boilerplate generated app.service.ts to "Hello worlds" and you will get this in console:

      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE: address already in use :::3000
    at Server.setupListenHandle [as _listen2] (net.js:1279:14)
    at listenInCluster (net.js:1327:12)
    at Server.listen (net.js:1414:7)
    at ExpressAdapter.listen (C:\Users\a\Desktop\Projects\Eves\administration\evesAdministration\node_modules\@nestjs\platform-express\adapters\express-adapter.js:44:32)
    at NestApplication.listen (C:\Users\a\Desktop\Projects\Eves\administration\evesAdministration\node_modules\@nestjs\core\nest-application.js:141:26)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:832:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
Emitted 'error' event at:
    at emitErrorNT (net.js:1306:8)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    at Function.Module.runMain (internal/modules/cjs/loader.js:832:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

Image for proof:

image

Restarted my laptop, repeated, issue still there. Tried with kebab-case named project, still same issue.

For Tooling issues:

kamilmysliwiec commented 5 years ago

Thanks for reporting! Please, try to update @nestjs/cli and @nestjs/schematics to their latest versions

mdurakovic commented 5 years ago

I did, both cli and schematics are latest versions but issue is still present.

image

kamilmysliwiec commented 5 years ago

Have you updated only global versions of packages? If you run npm run start:dev, it will use your local packages instead (so you have to update them as well)

mdurakovic commented 5 years ago

yes, they are updated too

image

johnbiundo commented 5 years ago

@mdurakovic it looks like you don't have the latest versions installed in your node_modules. Here's what I have after doing a fresh install:

  "devDependencies": {
    "@nestjs/cli": "^6.9.0",
    "@nestjs/schematics": "^6.7.0",
    "@nestjs/testing": "^6.7.1",
    "@types/express": "^4.17.1",
    "@types/jest": "^24.0.18",
    "@types/node": "^12.7.5",
...

Can you upgrade and try again? We did see an error like this in an earlier version, but I believe it's fixed in @latest.

mdurakovic commented 5 years ago

Thank you, I missed it. Simple npm update and hot reloading now works properly. Too bad this issue is present right from start of making new project, but lucky not a big problem

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.