Shims should not be absolute paths #104

Closed
creationix opened this Issue Jul 15, 2010 · 6 comments

Comments

Projects
None yet
2 participants
Contributor

creationix commented Jul 15, 2010

Now that node supports relative paths for installed libraries npm should support this for a fully portable node environment.

The paths in the generated shims should be relative, not absolute.

Owner

isaacs commented Jul 15, 2010

This is a dupe of #21, but I like this writeup better, so I'm closing that one instead :)

The hard part is when you have an exe in binroot and then it shims to a js file in root. Now that binroot is {prefix}/bin and the default root is {prefix}/lib/node, it's easier, but still, if you have them in weird places (like one in home, and the other in /usr/bin) then it gets trickier.

Contributor

creationix commented Jul 15, 2010

Can we just not put stuff in $HOME? Maybe have a config option for this.

Owner

isaacs commented Jul 16, 2010

It's not about $HOME specifically. Even if you don't put stuff in $HOME, they might be far away from one another. You could have your binroot set to /some/thing and then your root set to /thing/some, so the closest relative path ends up in fact being an absolute path.

Getting the closest relative path between two absolute paths is harder than it sounds. Check out Narwhal's mountain of tests for their path.relativize.

Owner

isaacs commented Jul 16, 2010

Maybe the solution is to put executables in $ROOT/.npm/bin, and expect people to put that in their PATH? I dunno. I think people expect to install something, and have the executable work right away. They don't read.

Contributor

creationix commented Jul 16, 2010

Well, in my case $PREFIX/bin is where I want binaries to go, and it's always ../lib/node to get to the libraries from there.

But yeah, I can see that being a problem in the general case.

Owner

isaacs commented Jul 26, 2010

Fixed on 6662d6e

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment