question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Path must be a string. Received undefined

See original GitHub issue

Following up on https://github.com/browserify/resolve/issues/177#issuecomment-453364771 (not sure whether it’s related), 1.9.0 has this code:

https://github.com/browserify/resolve/blob/254bb4029df2f8d20a33043dfabd8e5cabfa37df/lib/async.js#L47-L50

which throws an error if fs.realpath fails and the error is ENOENT, because then realStart is not defined.

TypeError: Path must be a string. Received undefined

This was already fixed in master in a commit prior to the release 1.9.0 (https://github.com/browserify/resolve/commit/2321cd4b4e184f9c97f76ea50dd49b9e42927b93#diff-688ede0ee2da1fa3d89f2fc485f39273), however has not yet been released.

Here is the same part with the fix on master:

https://github.com/browserify/resolve/blob/7c6afabf856bc0c4a268d1ba0d3328abef4ba8eb/lib/async.js#L58-L61

Can we get this fix out any time soon?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

4reactions
simonhaenischcommented, Jan 13, 2019

Please see https://github.com/browserify/resolve/compare/v1.9.0...simonhaenisch:fix-path-must-be-string, here is the test results without and with the fix.

Before:

# non-existent basedir should not throw when preserveSymlinks is false
path.js:28
    throw new TypeError('Path must be a string. Received ' + inspect(path));
    ^

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:28:11)
    at Object.resolve (path.js:1168:7)
    at init (~/resolve/lib/async.js:58:24)
    at ~/resolve/lib/async.js:49:18
    at gotStat (fs.js:1783:21)
    at FSReqWrap.oncomplete (fs.js:152:21)

After:

# non-existent basedir should not throw when preserveSymlinks is false
ok 1 should be equal
ok 2 should be equal

1..2
# tests 2
# pass  2

# ok

(ran with Node v8.15.0 on macOS)


My branch is based of v1.9.0, but I’m not sure how to open a PR against that because it seems I can only open one against a branch but not a tag. Maybe you’ll have to git checkout -b v1.9.0-patch v1.9.0 first and push it, so I can open the PR?

I don’t have a Windows instance to run the tests on btw.

1reaction
ljharbcommented, Jan 21, 2019

Merged into the next v1 release (will be v1.10.0); not yet merged into master. When it is, this will close.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest TypeError: Path must be a string. Received undefined
I solved this issue using: npm uninstall -g jest; npm install -g jest; npm cache clean; npm install.
Read more >
"Path must be a string. Received undefined" #144 - zkat/npx
Happy to try to help. The reason people all over www get 'Path must be a string' in Windows is because it it...
Read more >
path must be a string. received undefined when building a ...
I'm attempting to build a xamarin.ios project on a hosted agent. The project builds fine on a private agent we use, but in...
Read more >
Path must be a string. Received undefined - node-steam-user
Stack Trace: TypeError: Path must be a string. Received undefined at assertPath (path.js:28:11) at Object.join (path.js:489:7) at userData ...
Read more >
Meteor 1.5.2 TypeError: Path must be a string. Received ...
Meteor 1.5.2 TypeError: Path must be a string. Received undefined ... When I do meteor build and deploy to server, I get this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found