Closed paulirish closed 8 years ago
thanks for the issue, I'm looking into it now. (sorry @tunnckoCore and @paulirish looks like I was wrong on #2 and this might have been avoided)
While I'm looking for a fix, here is the code used by npm for the default global prefix.
also to clarify, @tunnckoCore / @paulirish, this issue would be resolved by using the custom prefix defined in npmrc
, correct?
Actually i made a workaround. Initially I thought this export $NODE_PATH=$(npm config get prefix)
would work, and have logic to work, but it didn't. So I mv node
executable from /usr/bin/node
to /usr/local/bin/node
, and i was partially surprised that it did not break anything. But in some case it may need also to create symbolic link from /usr/local/bin/node
to /usr/bin/node
(i'm not sure).
But yea.. haha, we always can do tricks, but it's not a good thing. :D
correct?
yes
Same issue for me. Installed node via homebrew without npm and then npm.
var prefix = require('global-prefix');
console.log(prefix);
==> /usr/local
but the correct path given by npm prefix -g
is:
npm prefix -g
==> /Users/xp/.node
I noticed this bug when calling npm-check -g
which depends on global-modules
See discussion here
@xapou, @tunnckoCore, @paulirish. Sorry for the delay, but the reason I haven't pushed up a fix for this is that I haven't found a satisfactory solution to the issue.
To confirm, are (were) you all using nvm
when the error occurred? I believe @tunnckoCore mentioned he was (correct?), and since comments from both @paulirish and @xapou mention homebrew, I'm wondering if this is related to https://github.com/creationix/nvm/issues/855.
cc @dylang
wasn't using nvm.
i have node installed through homebrew and I have homebrew configured to install inside of ~/.homebrew
instead of /usr/local
which is non-default, but fairly common.
wasn't using nvm.
same here. I started using nvm
(and currently using), because of these bugs. Node was installed through pacman
(archlinux package manager) which install inside /usr
- that's okey. And I set npm prefix to be /usr/local
to be able to use cli apps without sudo, including npm
.
I wasn't using nvm either.
Here's what
global-prefix
returns:Here's where they actually are:
cc @tunnckoCore