Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NestJs doesn't hot reload work in inside Docker #11010

Closed
2 of 15 tasks
Nundy opened this issue Feb 2, 2023 · 4 comments
Closed
2 of 15 tasks

NestJs doesn't hot reload work in inside Docker #11010

Nundy opened this issue Feb 2, 2023 · 4 comments
Labels
needs triage This issue has not been looked into

Comments

@Nundy
Copy link

Nundy commented Feb 2, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

use the listening mode in the docker container, and bind the volume, but modify the file under src, nest does not perform hot reload

Minimum reproduction code

https://github.com/Nundy/doesn-t-hot-reload-issue

Steps to reproduce

  1. "npm install"
  2. "docker compose up"

Expected behavior

wait for the docker container to be created and run nest, modify the main.ts file, the nest listener does not perform hot reloading

Package

  • I don't know. Or some 3rd-party package
  • @nestjs/common
  • @nestjs/core
  • @nestjs/microservices
  • @nestjs/platform-express
  • @nestjs/platform-fastify
  • @nestjs/platform-socket.io
  • @nestjs/platform-ws
  • @nestjs/testing
  • @nestjs/websockets
  • Other (see below)

Other package

No response

NestJS version

@9.3.1

Packages versions

package.json

"dependencies": {
    "@nestjs/common": "^9.0.0",
    "@nestjs/core": "^9.0.0",
    "@nestjs/platform-express": "^9.0.0",
    "reflect-metadata": "^0.1.13",
    "rxjs": "^7.2.0"
  },
  "devDependencies": {
    "@nestjs/cli": "^9.0.0",
    "@nestjs/schematics": "^9.0.0",
    "@nestjs/testing": "^9.0.0",
    "@types/express": "^4.17.13",
    "@types/jest": "29.2.4",
    "@types/node": "18.11.18",
    "@types/supertest": "^2.0.11",
    "@typescript-eslint/eslint-plugin": "^5.0.0",
    "@typescript-eslint/parser": "^5.0.0",
    "eslint": "^8.0.1",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^4.0.0",
    "jest": "29.3.1",
    "prettier": "^2.3.2",
    "source-map-support": "^0.5.20",
    "supertest": "^6.1.3",
    "ts-jest": "29.0.3",
    "ts-loader": "^9.2.3",
    "ts-node": "^10.0.0",
    "tsconfig-paths": "4.1.1",
    "typescript": "^4.7.4"
  }

Dockerfile

###################
# BUILD FOR LOCAL DEVELOPMENT
###################

FROM node:18-alpine As development

WORKDIR /usr/src/app

COPY --chown=node:node package*.json ./

RUN npm ci

COPY --chown=node:node . .

USER node

docker-compose.yml

version: '2.13.0'
services:
  api:
    build:
      dockerfile: Dockerfile
      context: .
      # Only will build development stage from our dockerfile
      target: development
    volumes:
      - .:/usr/src/app
      - /usr/src/app/node_modules
    # Run in dev Mode: npm run start:dev
    command: npm run start:dev
    ports:
      - 3000:3000

Node.js version

No response

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@Nundy Nundy added the needs triage This issue has not been looked into label Feb 2, 2023
@micalevisk
Copy link
Member

⚠️ We use GitHub Issues to track bug reports, feature requests and regressions

Try the following instead:

@micalevisk micalevisk closed this as not planned Won't fix, can't repro, duplicate, stale Feb 2, 2023
@micalevisk
Copy link
Member

english, please.

@Nundy
Copy link
Author

Nundy commented Feb 2, 2023

english, please.

sorry, it was just an automatic email reply, has anyone encountered the above problem? how can i solve

@smolinari
Copy link

@Nundy - Downgrade TypeScript to 4.8.4 or set up your tsconfig.json for 4.9.X. 4.9.X has a change in how the compiler watches files.

https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-9.html#file-watching-now-uses-file-system-events

Scott

@nestjs nestjs locked and limited conversation to collaborators Feb 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs triage This issue has not been looked into
Projects
None yet
Development

No branches or pull requests

3 participants