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

npm run start:dev is not working in docker #1

Open
junjielyu13 opened this issue Feb 3, 2023 · 4 comments
Open

npm run start:dev is not working in docker #1

junjielyu13 opened this issue Feb 3, 2023 · 4 comments

Comments

@junjielyu13
Copy link

junjielyu13 commented Feb 3, 2023

I saw your issue nestjs/nest#11010 and I encountered the same problem, start:dev can't run in docker, I ended up using nodemon instead of star:dev

This might not be the best way, but it works! !

make some changes on scripts in the package.json file:

  1. install nodemon: npm install typescript @types/node ts-node nodemon -D
  2. opt1: Change: "start:dev": "nest start --watch" to "start:dev": "nodemon --legacy-watch -x ts-node src/main.ts"
  3. opt2: Add a script: "nodemon": "nodemon --legacy-watch -x ts-node src/main.ts"

there is a reference:

Hope this helps you

@FelipeCO14
Copy link

FelipeCO14 commented Feb 15, 2023

It is absurd that nest is so buggy for something so essential and yet so simple as hot reloading when using docker...

I was thinking about using nodemon and this worked perfectly.

since I am using the setup with nestjs monorepo, I pass the main.ts path as a parameter to the command:

package.json

"nodemon": "nodemon --legacy-watch -x ts-node"

docker-compose

command: npm run nodemon -- apps/orders/src/main.ts

I notice moduleNameMapper is no longer working though. Not sure why, but I am fine without it.

@opexu
Copy link

opexu commented Feb 16, 2023

I solved the problem by replacing "typescript": "^4.7.4" to "typescript": "~4.7.4" and npm install again locally. I don't now what is the bug.

@ramkrishna500
Copy link

@sinanovicanes
Copy link

I had the same issue. Fixed by updating start:dev command in package.json with
"start:dev": "nest start --tsc --watch"
and adding watch options in tsconfig.json

"watchOptions": {
    "watchFile": "fixedPollingInterval"
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants