[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
After modifying a file, the application does not restart correctly
Relaunch app correctly.
$ npm i -g @nestjs/cli
$ nest new prueba
$ cd prueba
$ npm-run start:dev
[email protected] start:dev /tmp/prueba
nodemon
[nodemon] 1.18.4
[nodemon] to restart at any time, enter rs
[nodemon] watching: /tmp/prueba/src/*/
[nodemon] starting ts-node -r tsconfig-paths/register src/main.ts
[Nest] 8362 - 2018-11-24 18:10:12 [NestFactory] Starting Nest application...
[Nest] 8362 - 2018-11-24 18:10:12 [InstanceLoader] AppModule dependencies initialized +5ms
[Nest] 8362 - 2018-11-24 18:10:12 [RoutesResolver] AppController {/}: +10ms
[Nest] 8362 - 2018-11-24 18:10:12 [RouterExplorer] Mapped {/, GET} route +1ms
[Nest] 8362 - 2018-11-24 18:10:12 [NestApplication] Nest application successfully started +1ms
Edit for example main.ts
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
console.log('Hi NEST');
async function bootstrap() {
const app = await NestFactory.create(AppModule);
await app.listen(3000);
}
bootstrap();
In terminal:
[nodemon] restarting due to changes...
[nodemon] starting ts-node -r tsconfig-paths/register src/main.ts
Hi NEST!
[Nest] 8517 - 2018-11-24 18:12:49 [NestFactory] Starting Nest application...
[Nest] 8517 - 2018-11-24 18:12:49 [InstanceLoader] AppModule dependencies initialized +5ms
[Nest] 8517 - 2018-11-24 18:12:49 [RoutesResolver] AppController {/}: +10ms
[Nest] 8517 - 2018-11-24 18:12:49 [RouterExplorer] Mapped {/, GET} route +1ms
[Nest] 8517 - 2018-11-24 18:12:49 [NestApplication] Nest application successfully started +1ms
Error: listen EADDRINUSE :::3000
at Server.setupListenHandle [as _listen2] (net.js:1360:14)
at listenInCluster (net.js:1401:12)
at Server.listen (net.js:1485:7)
at NestApplication.listen (/tmp/prueba/node_modules/@nestjs/core/nest-application.js:205:25)
at
at process._tickDomainCallback (internal/process/next_tick.js:229:7)
at Function.Module.runMain (module.js:696:11)
at Object.
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
[nodemon] app crashed - waiting for file changes before starting...
Development is an impossible task.
Project created weeks ago works like a charm.
Nest version: latest installed by nest-cli
For Tooling issues:
- Node version: 8.13.0
- Platform: Ubuntu 18.04
Others:
Package.json
{
"name": "prueba",
"version": "0.0.0",
"description": "description",
"author": "",
"license": "MIT",
"scripts": {
"format": "prettier --write \"src/*/.ts\"",
"start": "ts-node -r tsconfig-paths/register src/main.ts",
"start:dev": "nodemon",
"start:debug": "nodemon --config nodemon-debug.json",
"prestart:prod": "rimraf dist && tsc",
"start:prod": "node dist/main.js",
"start:hmr": "node dist/server",
"lint": "tslint -p tsconfig.json -c tslint.json",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:e2e": "jest --config ./test/jest-e2e.json",
"webpack": "webpack --config webpack.config.js"
},
"dependencies": {
"@nestjs/common": "^5.1.0",
"@nestjs/core": "^5.1.0",
"reflect-metadata": "^0.1.12",
"rxjs": "^6.2.2",
"typescript": "^3.0.1"
},
"devDependencies": {
"@nestjs/testing": "^5.1.0",
"@types/express": "^4.16.0",
"@types/jest": "^23.3.1",
"@types/node": "^10.7.1",
"@types/supertest": "^2.0.5",
"jest": "^23.5.0",
"nodemon": "1.18.4",
"prettier": "^1.14.2",
"rimraf": "^2.6.2",
"supertest": "^3.1.0",
"ts-jest": "^23.1.3",
"ts-loader": "^4.4.2",
"ts-node": "^7.0.1",
"tsconfig-paths": "^3.5.0",
"tslint": "5.11.0",
"webpack": "^4.16.5",
"webpack-cli": "^3.1.0",
"webpack-node-externals": "^1.7.2"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "src",
"testRegex": ".spec.ts$",
"transform": {
"^.+\.(t|j)s$": "ts-jest"
},
"coverageDirectory": "../coverage",
"testEnvironment": "node"
}
}
Nodemon leaves orphan processes running sometimes when it is killed. Assuming you are on windows go into the task manager and kill the nodejs process
I'm on Ubuntu. Nodemon is unable to kill previous process
El sáb., 24 nov. 2018 18:30, Jay Bell notifications@github.com escribió:
Nodemon leaves orphan processes running sometimes when it is killed.
Assuming you are on windows go into the task manager and kill the nodejs
process—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/nestjs/nest/issues/1313#issuecomment-441383011, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AGw4j7ciAcvg6EQDpCy_9UGQ--CMDFyJks5uyYJKgaJpZM4YxgpI
.
It could still be leaving an orphan process running on port 3000. Use the command line to check what processes are running on that port and kill it then restart nodemon.
I've proved this option some times.
The only way to make It works It has copy node_modules from another project
El sáb., 24 nov. 2018 18:36, Jay Bell notifications@github.com escribió:
It could still be leaving an orphan process running on port 3000. Use the
command line to check what processes are running on that port and kill it
then restart nodemon.—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/nestjs/nest/issues/1313#issuecomment-441383376, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AGw4jzDLYMCjzw5vATq3dsgc1qgOapFFks5uyYOhgaJpZM4YxgpI
.
Honestly, I don't think that this issue is related to Nest itself. Please, use StackOverflow for such questions
I'm not sure if this helps, but I wasn't seeing this until I added graphql Subscriptions. Now while running yarn start:dev nodemon never rebuilds .... it just crashes on file change. I'm guessing it has something to do with graphql-subscriptions still holding on to the ::4000 port when nodemon restarts /shrug
If anyone figures this out, let me know and I'll do the same.
Just update your nodemon package to 1.18.7 global or local
I trying now and it working
👍
I also dockerized my app using docker-compose and was still having the issue. Evidently, node:10.14-alpine doesn't play well with nodemon. I changed my base image to node:10.14 and it worked perfectly 😎
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.
Most helpful comment
Just update your nodemon package to 1.18.7 global or local
I trying now and it working