Skip to content

[BUG] Hot reloading doesnt work with typescript 4.9.3 #10027

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

Closed
gonzalormonja opened this issue Nov 29, 2022 · 8 comments
Closed

[BUG] Hot reloading doesnt work with typescript 4.9.3 #10027

gonzalormonja opened this issue Nov 29, 2022 · 8 comments
Labels

Comments

@gonzalormonja
Copy link

Description

Hi! First of all sorry for my english, I supported myself with a translation.
This error appears when I create a new nestJS project. I can't use the hot reload unless I change the typescript version to 4.7.3.
Here is a sample repository with a minimal reproduction of the bug.
Just change the typescript version in package.json in devDependencies from 4.9.3 to 4.7.3 and the project will start working.

Translated with www.DeepL.com/Translator (free version)

Steps To Reproduce

Clone the repository: https://github.com/gonzalormonja/-BUG-Hot-reloading-doesnt-work-with-typescript-4.9.3.git

docker compose up

change main.ts and save

expected: reload server, doesnt work

change change the typescript version in package.json in devDependencies "4.7.3"

execute npm i

docker compose up

change main.ts and save

expected: reload server, work

Compose Version

2.12.2

Docker Environment

Client:
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.9.1-docker)
  compose: Docker Compose (Docker Inc., v2.12.2)
  dev: Docker Dev Environments (Docker Inc., v0.0.3)
  extension: Manages Docker extensions (Docker Inc., v0.2.13)
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scan: Docker Scan (Docker Inc., v0.21.0)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 20.10.21
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 1c90a442489720eec95342e1789ee8a5e1b9536f
 runc version: v1.1.4-0-g5fd4c4d
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.15.49-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 2.731GiB
 Name: docker-desktop
 ID: D6Q3:U3BX:M5SB:7JZ7:7NJ5:KLZH:PHWR:SJH4:VDBZ:5G4G:IJJH:F55F
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5000
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

No response

@ndeloof
Copy link
Contributor

ndeloof commented Nov 30, 2022

I tried to run you reproduction project, but it fails:

$ docker compose up
[+] Running 1/1
 ⠿ Container toto-api-1  Recreated                                         0.2s
Attaching to toto-api-1
toto-api-1  | 
toto-api-1  | > new-proj@0.0.1 start:dev
toto-api-1  | > nest start --watch
toto-api-1  | 
toto-api-1  | sh: nest: not found
toto-api-1 exited with code 127

but I also wonder this is an actual Docker Compose issue: could you try running a plain docker container for this same project :

docker build test .
docker run -p 3002:3000 -v $(pwd):/usr/src/app --rm -it test npm run start:dev

If same issue also applies to a plain docker container, then there's nothing we can do as Compose maintainers

@gonzalormonja
Copy link
Author

Hi, sorry. Need execute npm i before run docker compose up.

As soon as I can I will try what you say

@fjodor-rybakov
Copy link

Same problem

Work only with ts 4.8.4

@ndeloof
Copy link
Contributor

ndeloof commented Dec 7, 2022

for some weird reason I can't build your Dockerfile:

 > [4/5] RUN npm i:
#0 289.9 npm ERR! code ENETUNREACH
#0 289.9 npm ERR! syscall connect
#0 289.9 npm ERR! errno ENETUNREACH
#0 289.9 npm ERR! request to https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz failed, reason: connect ENETUNREACH 2606:4700::6810:1b23:443
#0 290.0 
#0 290.0 npm ERR! A complete log of this run can be found in:
#0 290.0 npm ERR!     /root/.npm/_logs/2022-12-07T08_44_32_880Z-debug-0.log
------
ERROR: failed to solve: executor failed running [/bin/sh -c npm i]: exit code: 1

... while npm install can run succesfully on my laptop 🤨 .. so I tweaked the Dockerfile to use local node_modules

and then, I can see File change detected. Starting incremental compilation... to take place any time I save changes to main.ts.

ANYWAY please confirm this is a Compose issue by reproducing this bug with a plain docker container, i.e. docker run -v $(pwd):/usr/src/app --rm -it xxxx npm run start:dev

@laurazard
Copy link
Contributor

Closing since it's been a while, please ping us with additional information (as requested above) for us to re-open and investigate if desired.

@gabriel-messas
Copy link

Same problem

Work only with ts 4.8.4

Yes, as the default method for file watching has changed in TypeScript version 4.9.

@fjodor-rybakov
Copy link

Same problem
Work only with ts 4.8.4

Yes, as the default method for file watching has changed in TypeScript version 4.9.

How can I fix this without downgrading?

@gabriel-messas
Copy link

Same problem
Work only with ts 4.8.4

Yes, as the default method for file watching has changed in TypeScript version 4.9.

How can I fix this without downgrading?

Unfortunately, nobody knows it yet.

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

No branches or pull requests

5 participants