TypeError: Path must be a string. Received null
testerez opened this issue · comments
After upgrading ts-node from version 3.2 to 3.3, we started having this issue on our dev server. We can't reproduce it on our mac workstations.
It seams like this is introduced by the upgrade to v8flags@3.0.0.
We are downgrading as it fixes our issue but I wanted to let you know...
TypeError: Path must be a string. Received null
at assertPath (path.js:7:11)
at Object.basename (path.js:1355:5)
at linux (/opt/apps/pbv4/release/08022017145510/node_modules/v8flags/config-path.js:19:25)
at module.exports (/opt/apps/pbv4/release/08022017145510/node_modules/v8flags/config-path.js:32:10)
at Object.<anonymous> (/opt/apps/pbv4/release/08022017145510/node_modules/v8flags/index.js:10:47)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
error Command failed with exit code 1.
Ping @Siilwyn
Thank you for reporting, I'm responsible for this change.
This error looks like it's coming from the user-home
module returning null. Wondering if we should have a fallback or handle it on user-home
module level.
Could you be so kind to start node
and in the REPL run os.homedir()
on the dev server and report the result?
Edit: if you have the time I would appreciate it if you also try homedir-polyfill
, there's an open issue about moving to that polyfill which might solve this too.
Thank you! That means the user-home
module is not behaving the same as os.homedir
...
Could you try the following?
npm install homedir-polyfill; npm install user-home@1.1.1
console.log(
'user-home: ' + require('user-home'),
'\n',
'homedir-polyfill: ' + require('homedir-polyfill')()
);
@Siilwyn :
user-home: null
homedir-polyfill: /root
👍 on homedir-polyfill switch
Nice debugging ya'll, and thanks @Siilwyn for tackling this so quickly.
This issue goes a bit further than expected, the logic for falling back is already in place but was basically 'skipped'.