Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Path must be a string. Received null #41

Closed
testerez opened this issue Aug 2, 2017 · 8 comments · Fixed by #42 · May be fixed by ajesse11x/flightplan#4
Closed

TypeError: Path must be a string. Received null #41

testerez opened this issue Aug 2, 2017 · 8 comments · Fixed by #42 · May be fixed by ajesse11x/flightplan#4
Assignees

Comments

@testerez
Copy link

testerez commented Aug 2, 2017

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 [email protected].

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.
@phated
Copy link
Member

phated commented Aug 2, 2017

Ping @Siilwyn

@Siilwyn
Copy link
Contributor

Siilwyn commented Aug 2, 2017

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.

@philipperoy1
Copy link

philipperoy1 commented Aug 2, 2017

@Siilwyn the result of os.homedir() is /root.
Hope it helps !
(btw, I work with @testerez )

@Siilwyn
Copy link
Contributor

Siilwyn commented Aug 2, 2017

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 [email protected]

console.log(
'user-home: ' + require('user-home'),
'\n',
'homedir-polyfill: ' + require('homedir-polyfill')()
);

@philipperoy1
Copy link

@Siilwyn :

user-home: null
homedir-polyfill: /root

@phated
Copy link
Member

phated commented Aug 2, 2017

👍 on homedir-polyfill switch

@tkellen
Copy link

tkellen commented Aug 2, 2017

Nice debugging ya'll, and thanks @Siilwyn for tackling this so quickly.

Siilwyn added a commit that referenced this issue Aug 3, 2017
Change the module that retrieves the user home directory. When on
Windows the module can still return null, moving fallback logic to the
config-path prevents it from returning null.

Resolves #41
@Siilwyn
Copy link
Contributor

Siilwyn commented Aug 3, 2017

This issue goes a bit further than expected, the logic for falling back is already in place but was basically 'skipped'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants