wds icon indicating copy to clipboard operation
wds copied to clipboard

Getting process exit code 1 when changing files

Open lostpebble opened this issue 2 years ago • 4 comments

"C:\Program Files\nodejs\npm.cmd" run service-dev-watch

> [email protected] service-dev-watch
> wds --inspect=9230 ./src/index.ts

Debugger listening on ws://127.0.0.1:9230/f2cb6f48-1b77-4214-bf73-9f447f5b8098
For help, see: https://nodejs.org/en/docs/inspector
Running!!!
Service listening on port: 8080
Debugger attached.
[wds pid=23084] \src\index.ts changed, restarting ...

Process finished with exit code 1

Hi there, just started using this project today- but noticed the "hot reload" doesn't work for me. This includes simple updates like just changing the text inside a console.log(). I know it has nothing to do with the --inspect=9230 as I tried without it and it still threw the error.

lostpebble avatar May 23 '22 16:05 lostpebble

> [email protected] service-dev-watch
> cross-env WDS_DEBUG=1 ./node_modules/.bin/wds --inspect=9230 ./src/index.ts

[wds pid=12836] starting wds for workspace root C:\dev\github\xxx and workdir C:\Users\paulm\AppData\Local\Temp\wdsLTDysI
[wds pid=12836] Not loading project config from C:\dev\github\xxx\wds.js, error encountered: ENOENT: no such file or directory, access 'C:\dev\github\xxx\wds.js'
[wds pid=12836] Starting supervisor server at \\?\pipe\C:\Users\paulm\AppData\Local\Temp\wdsLTDysI\ipc.sock
[wds pid=12836] Started HTTP server on \\?\pipe\C:\Users\paulm\AppData\Local\Temp\wdsLTDysI\ipc.sock
[wds pid=12836] searching for filenames {
  config: { ignore: [], extensions: [ '.ts', '.tsx', '.jsx' ] },
  root: 'C:\\dev\\github\\xxx',
  globs: [
    '**/*{.tsx,.ts,.jsx,.mjs,.cjs,.js}',
    '!node_modules',
    '!**/*.d.ts'
  ]
}
[wds pid=12836] started build {
  root: 'C:\\dev\\github\\xxx',
  promptedBy: 'C:\\dev\\github\\xxx\\src\\index.ts',
  files: 5
}
Running!!!
Service listening on port: 8080
[wds pid=1516] syncworker file boot { isMainThread: false, hasWorkerData: true }
Debugger attached.
[wds pid=12836] \src\index.ts changed, restarting ...
[wds pid=12836] rebuild { duration: '0.03871' }
[wds pid=12836] child process exited with code null, exiting...

Process finished with exit code 1

This is the output using DEBUG mode.

lostpebble avatar May 23 '22 16:05 lostpebble

Hm, it looks like you're running on WSL right? We have no formal support for windows or WSL but I will look into adding it. PRs also welcome! Also, that message is expected when the script you're actually running quits -- any chance you can share the contents of that script, or report that it works under other runners?

airhorns avatar May 24 '22 13:05 airhorns

Sure, this is the script. If I change anything inside of it, I get the exit code 1.

import koa from "koa";
import { ServiceConfig } from "./service_config";
import { middleware_health_check, middleware_ignore_favicon } from "./middleware/AppBasicMiddleware";
import logger from "koa-logger";

const { port } = ServiceConfig.getConfig();

const app = new koa({
  keys: ["xxx_secret_abc_123"]
});

app.use(logger());
app.use(middleware_ignore_favicon);
app.use(middleware_health_check);

app.use(async (ctx) => {
  ctx.body = "Hiiiii!";
});

app.listen(port, () => {
  console.log(`Service listening on port: ${port}`);
});

I'm not running WSL- just regular Windows.

I'm not sure what other runtimes I could compare it with. I can confirm that using nodemon to watch an output "dev-build" directory, which itself is watched and rebuilt by esbuild, runs and restarts without issue.

lostpebble avatar May 24 '22 14:05 lostpebble

@lostpebble we just fixed a couple bugs with the --watch mode, could you try running with it now? Also, the default is no longer to watch/supervise by default, and so you'll have to update your scripts to pass --watch explicitly now

airhorns avatar Jul 07 '22 22:07 airhorns