sultan99 / sexy-require

💃🏻 No more ugly path.
MIT License
40 stars 1 forks source link

Not working with yargs #2

Closed ogroppo closed 6 years ago

ogroppo commented 6 years ago

TypeError: Cannot read property '1' of null at callerPath (/node_modules/sexy-require/index.js:41:29) at getRoot (/node_modules/sexy-require/index.js:52:22) at rootPath (/node_modules/sexy-require/index.js:59:14) at Module.require (/node_modules/sexy-require/index.js:84:30)

sultan99 commented 6 years ago

@ogroppo what OS do you use?

ogroppo commented 6 years ago

Hi there, using macOS High Sierra

sultan99 commented 6 years ago

@ogroppo can you replace function callerPath() by

function callerPath() {
  var err = new Error()
  var re = /at require \(internal\/module\.js:11:18\)\n.+\((.*):\d+:\d+\)/m
  return err.stack.match(re)[1]
}

in index.js of sexy-require?

I can't test it right now as I don't have the macOS. If it is OK I will patch it.

sultan99 commented 6 years ago

@ogroppo Hi! Have you check it?

ogroppo commented 6 years ago

Sorry mate, I deleted that project now and I am not able to recreate that scenario in a new one. However, I'll be using this package now so I'll let you know if that happens again! cheers