stackblitz / webcontainer-core

Dev environments. In your web app.
https://webcontainers.io
MIT License
3.91k stars 166 forks source link

npm run start:dev - file change crashs the server #1239

Closed phpjob closed 1 year ago

phpjob commented 1 year ago

Describe the bug

If i running -> npm run start:dev to start the watch mode, it crashs, after i changed a file.

[8:36:13 PM] File change detected. Starting incremental compilation...

[8:36:13 PM] Found 0 errors. Watching for file changes.

TypeError: Cannot read properties of null (reading 'forEach')
    at ChildProcess.onClose (file:///home/projects/nestjs-typescript-starter-68a5xs/node_modules/tree-kill/index.js:108:30)
    at EventEmitter.emit (https://nestjstypescriptstarter68a5xs-rtw3-l7qnuehb.w-credentialless.staticblitz.com/blitz.09144545.js:42:9208)
    at maybeClose (https://nestjstypescriptstarter68a5xs-rtw3-l7qnuehb.w-credentialless.staticblitz.com/blitz.09144545.js:206:13333)
    at Socket.<anonymous> (https://nestjstypescriptstarter68a5xs-rtw3-l7qnuehb.w-credentialless.staticblitz.com/blitz.09144545.js:206:5380)
    at EventEmitter.emit (https://nestjstypescriptstarter68a5xs-rtw3-l7qnuehb.w-credentialless.staticblitz.com/blitz.09144545.js:42:9208)
    at https://nestjstypescriptstarter68a5xs-rtw3-l7qnuehb.w-credentialless.staticblitz.com/blitz.09144545.js:54:3336
    at _0x5a288f.close (https://nestjstypescriptstarter68a5xs-rtw3-l7qnuehb.w-credentialless.staticblitz.com/blitz.09144545.js:352:352059)
    at _0x2db34b.<computed>.close (https://nestjstypescriptstarter68a5xs-rtw3-l7qnuehb.w-credentialless.staticblitz.com/blitz.09144545.js:352:480971)
    at closeSocketHandle (https://nestjstypescriptstarter68a5xs-rtw3-l7qnuehb.w-credentialless.staticblitz.com/blitz.09144545.js:54:3306)
    at Socket._destroy (https://nestjstypescriptstarter68a5xs-rtw3-l7qnuehb.w-credentialless.staticblitz.com/blitz.09144545.js:54:9913)

Link to the blitz that caused the error

https://stackblitz.com/edit/nestjs-typescript-starter-68a5xs?file=src%2Fapp.controller.ts,src%2Fapp.service.ts&terminal=start

Steps to reproduce

  1. Go to terminal and press cmd+c (mac)
  2. write npm run start:dev
  3. Go to the app.service.ts under src/
  4. Change a file
  5. It crashs, the log is in the terminal.

Expected behavior

Should not crash on a file change.

Screenshots

No response

Platform

Browser name  = Chrome
Full version  = 118.0.0.0
Major version = 118
navigator.appName = Netscape
navigator.userAgent = Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36
performance.memory = {
  "totalJSHeapSize": 173664166,
  "usedJSHeapSize": 138279262,
  "jsHeapSizeLimit": 4294705152
}
Hash = 09144545

Additional context

I run this with a fresh nestjs setup.

jrvidal commented 1 year ago

:wave: This is indeed a bug on our side, we're now tracking it internally.

Thanks for the report!

d3lm commented 1 year ago

Just letting you know that the issue has been fixed. I tried your project again and it now re-compiles successfully and when reloading the preview it reflects the changes. I am going to close this issue but if there's still an issue you're running into, feel free to file a new ticket.

phpjob commented 1 year ago

Wow, that was a quick fix. You deserved a subscription for that 👍 .

@jrvidal @d3lm Thank you very much, I can confirm that it also works in newly set up projects.