Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

npm munges path #2886

Closed
blalor opened this issue Oct 16, 2012 · 1 comment
Closed

npm munges path #2886

blalor opened this issue Oct 16, 2012 · 1 comment

Comments

@blalor
Copy link

blalor commented Oct 16, 2012

I'm trying to debug an error I'm getting when installing gitteh. I'm running on CentOS 5.8, whose /usr/bin/python is 2.4. I've got python2.6 on the path and when I built my RPM for nodejs I modified all instances of #!/usr/bin/env python#!/usr/bin/env python2.6, but that's not sufficient for scripts (like waf) that use #!/usr/bin/env python. So, as a total kludge I created ~/tmp/path_whackamole, created a symlink from /usr/bin/python2.6 to ~/tmp/path_whackamole/python and put ~/tmp/path_whackamole first on the path.

npm's lib/utils/lifecycle.js adds a couple of elements onto the front of the PATH and blindly assumes that I want /usr/bin (the path where node lives) first. I do not.

npm and node are in /usr/bin. I'm attempting to install a package from ~/tmp/package. Existing PATH is /home/blalor/tmp/path_whackamole:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/blalor/bin

What npm actually does:

/usr/bin:/usr/lib/node_modules/npm/bin/node-gyp-bin:/home/blalor/tmp/package/node_modules/.bin:/home/blalor/tmp/path_whackamole:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/blalor/bin

I suppose what npm should do is up for debate, I suppose, but I don't want my PATH to be smashed…

@isaacs
Copy link
Contributor

isaacs commented Oct 16, 2012

I don't think that this is a problem that can be solved in a general way. Take it up with the CentOS rulers who decided that it was a good idea to have multiple different versions of python all installed at the same time.

I think you can set the PYTHON environment variable to /usr/bin/python2.6 and it should work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants