npm munges path #2886

blalor opened this Issue Oct 16, 2012 · 1 comment


None yet
2 participants

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:


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


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.

@isaacs isaacs closed this Oct 16, 2012

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