ERR_INVALID_ARG_TYPE on macOS 10.15 node v14.1.0
aklkv opened this issue · comments
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'
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.
@alanlima Thank you so much for solution! I can confirm it fixes the issue for me!
Guess, there is only the way to patch this file locally, since no release since 2018. Thanks for the fix.