typicode / hotel

🏩 A simple process manager for developers. Start apps from your browser and access them using local domains
MIT License
9.97k stars 426 forks source link

ERR_INVALID_ARG_TYPE on macOS 10.15 node v14.1.0 #360

Open aklkv opened 4 years ago

aklkv commented 4 years ago
Watching /Users/aklkv/.hotel/servers
create /Users/aklkv/.hotel/daemon.pid 3384
internal/fs/utils.js:658
    throw new ERR_INVALID_ARG_TYPE(
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (3384)
    at Object.writeFileSync (fs.js:1380:5)
    at Object.create (/usr/local/lib/node_modules/hotel/lib/pid-file.js:18:13)
    at Object.<anonymous> (/usr/local/lib/node_modules/hotel/lib/daemon/index.js:20:9)
    at Module._compile (internal/modules/cjs/loader.js:1176:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1196:10)
    at Module.load (internal/modules/cjs/loader.js:1040:32)
    at Function.Module._load (internal/modules/cjs/loader.js:929:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'ERR_INVALID_ARG_TYPE'
alanlima commented 4 years ago

Hi @aklkv I also have this same issue here and I found out that the validation on fs.writeFileSync changed to not allow numbers to be passed in.

A quick fix is to change the pid-file.js:

function create() {
  console.log('create', pidFile, process.pid)
-  return fs.writeFileSync(pidFile, process.pid)
+  return fs.writeFileSync(pidFile, process.pid.toString())
}

I created the PR #361 to fix it.

aklkv commented 4 years ago

@alanlima Thank you so much for solution! I can confirm it fixes the issue for me!

alexrjs commented 4 years ago

Guess, there is only the way to patch this file locally, since no release since 2018. Thanks for the fix.

zachwill commented 3 years ago

Hey @alanlima @typicode,

This is 100% the solution to get hotel working on Mac OS 10.15 with node v14.9.0

Any chance we could get #361 merged? (As @alexrjs suggests, the only other way is to patch pid-file.js locally.)

Thanks!