Closed olsonpm closed 8 years ago
Hmm, this is an interesting issue. Arguably, it should return /home/<username>/.nvm/v0.10.36/lib/node_modules/exampleCLI/
without the bin/
component. The reason you're not getting /home/<username>/.nvm/v0.10.36/lib/
is because you're dealing with a node global path.
Interesting. Let me give it a bit of thought. This is another example of how many freaking edge cases there are where it's hard to say what the "root path" actually is :)
I am currently experiencing this issue as well. I created and installed a global npm module that has a cli command, and app-root-path reports the
Hrm, seems like maybe there needs to be custom logic for bin/
(and /.bin
perhaps). It seems like unless your module is called "bin" it should be fine, and this is common npm functionality…
Yeah...if you are naming your project "bin" you are just asking for things to break.
@zero5100 are you using nvm as well?
@inxilpro Yes, I am.
The latest commits should fix this. Sorry it took so long. You can try it with:
npm i -S app-root-path@beta
I'll publish as 1.1.0
shortly after a little more testing.
Not a problem - and thanks much!
Would you mind confirming that the fix works as expected?
I'm busy tonight but will get to it tomorrow.
Of course! Whenever you have time…
Got around to it just now - works as expected.
woot
Experiencing this same issue but with src
where the project is a CLI whose index lives at ./src/index.js
.
Example repository which exhibits the behavior
https://github.com/olsonpm/exampleCLI
Now based on the readme (and without digging into your code), I couldn't tell if it should be reporting /home//.nvm/v0.10.36/lib
or
/home//.nvm/v0.10.36/lib/node_modules/exampleCLI
however I didn't expect it to report the bin directory