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 Dev server keeps restarting in a loop on ubuntu #10277

Closed
4 of 15 tasks
niteshbalusu11 opened this issue Sep 13, 2022 · 9 comments
Closed
4 of 15 tasks

NestJs Dev server keeps restarting in a loop on ubuntu #10277

niteshbalusu11 opened this issue Sep 13, 2022 · 9 comments
Labels
needs triage This issue has not been looked into

Comments

@niteshbalusu11
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

My nestjs dev server keeps restarting a loop when starting with nest start --watch on Ubuntu machines. It works fine on windows and mac.

It keeps giving the following messages before restarting: Is it some typescript issue?

[10:09:53 PM] File change detected. Starting incremental compilation...

[10:09:54 PM] Found 0 errors. Watching for file changes.

Minimum reproduction code

https://github.com/niteshbalusu11/lndboss

Steps to reproduce

  1. Clone the repo on ubuntu machine
  2. Install deps using yarn
  3. yarn dev to start the dev server
  4. watch it restart in an infinite loop.

Expected behavior

The Dev server only restarts when it detects changes.

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.0.11

Packages versions

  "dependencies": {
    "@emotion/react": "^11.10.4",
    "@emotion/styled": "^11.10.4",
    "@mui/icons-material": "^5.10.3",
    "@mui/material": "^5.10.4",
    "@mui/x-date-pickers": "^5.0.0",
    "@nestjs/common": "^9.0.11",
    "@nestjs/config": "^2.2.0",
    "@nestjs/core": "^9.0.11",
    "@nestjs/jwt": "^9.0.0",
    "@nestjs/passport": "^9.0.0",
    "@nestjs/platform-express": "^9.0.11",
    "@nestjs/platform-socket.io": "^9.0.11",
    "@nestjs/schedule": "^2.1.0",
    "@nestjs/websockets": "^9.0.11",
    "antd": "^4.23.0",
    "async": "^3.2.4",
    "axios": "^0.27.2",
    "balanceofsatoshis": "^12.27.0",
    "bcryptjs": "^2.4.3",
    "chart.js": "^3.9.1",
    "class-sanitizer": "^1.0.1",
    "class-transformer": "^0.5.1",
    "class-validator": "^0.13.2",
    "json-to-pretty-yaml": "^1.2.2",
    "jwt-decode": "^3.1.2",
    "lightning": "^5.21.0",
    "nest-winston": "^1.7.0",
    "next": "^12.2.5",
    "notiflix": "^3.2.5",
    "passport": "^0.6.0",
    "passport-jwt": "^4.0.0",
    "passport-local": "^1.0.0",
    "qrcode.react": "^3.1.0",
    "react": "^18.2.0",
    "react-chartjs-2": "^4.3.1",
    "react-copy-to-clipboard": "^5.1.0",
    "react-dom": "^18.2.0",
    "react-js-cron": "^2.1.2",
    "reflect-metadata": "^0.1.13",
    "rxjs": "^7.5.6",
    "socket.io-client": "^4.5.2"
  },

Node.js version

16.17.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@niteshbalusu11 niteshbalusu11 added the needs triage This issue has not been looked into label Sep 13, 2022
@micalevisk
Copy link
Member

didn't manage to reproduce your issue

image

Make sure your code didn't end up changing any TS file under src/

@niteshbalusu11
Copy link
Author

niteshbalusu11 commented Sep 13, 2022

oops. can you create a .env file in the root of the project and add this to the file and restart.
ENCRYPTION_KEY="b4970320a3601d19b876c18ce2eb895d687962d3f0b72e0d4de05ed74be34d9a"

@micalevisk
Copy link
Member

same error, no loops

@micalevisk
Copy link
Member

micalevisk commented Sep 13, 2022

ok, I've run cp .env.example .env but got no loops on yarn dev

image


EDIT:

nvm.

@niteshbalusu11
Copy link
Author

ah yeah, I accidentally typed the wrong key in .env. It's called JWT_SECRET_DEV.
Ok, you have managed to reproduce then.
What I don't understand is, that it does not happen on a mac or windows.

@micalevisk
Copy link
Member

micalevisk commented Sep 13, 2022

looks like that happens due to this onModuleInit: https://github.com/niteshbalusu11/lndboss/blob/0103bc4b7c37f97e6da749c3f9af331ae7e84db5/src/server/modules/view/view.service.ts#L14

image

because you have src/client as 'dir' (not sure what is that tho) and your tsc is being watching that directory

@micalevisk micalevisk closed this as not planned Won't fix, can't repro, duplicate, stale Sep 13, 2022
@niteshbalusu11
Copy link
Author

Ok. Will take a look, wonder why it doesn't happen on mac and windows though.

Thank you.

@dhia-rizqullah
Copy link

Hey, @niteshbalusu11. Have you perchance found the solution to this problem?

I have the same setup (nest, next, ubuntu) & encountered the same exact problem. My coworkers that use Mac also do not encounter this issue.

@niteshbalusu11
Copy link
Author

Hey, @niteshbalusu11. Have you perchance found the solution to this problem?

I have the same setup (nest, next, ubuntu) & encountered the same exact problem. My coworkers that use Mac also do not encounter this issue.

Nope, never found the solution. I just use a Mac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage This issue has not been looked into
Projects
None yet
Development

No branches or pull requests

3 participants