I mistakingly passed a filename as basedir option.
I found the error message quite confusing:
TypeError: Cannot read property 'isFile' of undefined
at isFile (/Users/gaearon/p/test113/node_modules/resolve/lib/sync.js:12:20)
at loadAsFileSync (/Users/gaearon/p/test113/node_modules/resolve/lib/sync.js:36:13)
at loadNodeModulesSync (/Users/gaearon/p/test113/node_modules/resolve/lib/sync.js:75:21)
This is because there is an early exit for "file not found" errors, but for any other errors we fall through to where stat doesn't exist.
Just filing this for future readers.