I installed node the following way:
after that I changed the npm prefix..
mkdir ~/.npmglobals
npm config set prefix '~/.npmglobas'
change in bashrc my path.. adding .npmglobals/bin
after that I try to install n:
npm install -g n
Problems:
What could I have wrong ?
Thanks.
EDIT:
~/.npmglobals $> n stable
install : node-v6.2.2
mkdir : /usr/local/n/versions/node/6.2.2
fetch : https://nodejs.org/dist/v6.2.2/node-v6.2.2-linux-x64.tar.gz
cp: cannot create symbolic link '/usr/local/bin/npm': Permission denied
cp: cannot create regular file '/usr/local/bin/node': Permission denied
cp: cannot create directory '/usr/local/lib/node_modules': Permission denied
cp: cannot create directory '/usr/local/include/node': Permission denied
cp: cannot create directory '/usr/local/share/man/man1': Permission denied
cp: cannot create directory '/usr/local/share/systemtap': Permission denied
cp: cannot create directory '/usr/local/share/doc': Permission denied
installed : v4.2.6
I just realized there is an permission denied message.. but if I do, sudo.. n is not detected.
I have the same problem :(
We could probably try using N_PREFIX to change where n works. That should resolve our issue. Did you try some workarounds ?
Had some one the same problem ? To the moment, I still not able to change my node version
in case anybody comes looking for a solution, make sure:
bin directory E.g.
npm config set prefix "~/.npm-global"
N_PREFIX=~/.npm-global/node
PATH=~/.npm-global/node/bin:$PATH
@creynders using PATH=~/.npm-global/node/bin:$PATH instead of PATH=~/.npm-global/bin:$PATH (_as documented in npm 'fixing npm permissions' here_) made the command n unavailable (_command not found_).
And remove the system-wide node version in /usr/local/bin made node unavailable (_command not found_) and break npm.
Maybe a step is missing in your explanations? Or something has change since February?
@yamsellem no idea, it did the trick on my system. There's so many things (config options, path settings, etc) that can conflict it's really hard to find a panacea I think
What are the defaults? Ie- how do I undo :
npm config set prefix "~/.npm-global"
N_PREFIX=~/.npm-global/node
PATH=~/.npm-global/node/bin:$PATH
(on my system, can no longer install or uninstall global modules after doing that - install / uninstall commands appear to work fine but nothing happens either for uninstall or on install the system says the app installed is not found)
To answer my own question above, just set the npm config set prefix, N_PREFIX, and PATH as indicated in the n readme (under the Installation/n-install area) where it says sets both PREFIX and N_PREFIX to $HOME/n, installs n to $HOME/n/bin, modifies the initialization files of supported shells to export N_PREFIX and add $HOME/n/bin to the PATH
This issue has not had any activity in over six months. It isn't likely to get acted on due to this report.
Feel free to open a new issue if it comes up again, with new information and renewed interest.
Thank you for your contributions.
Most helpful comment
in case anybody comes looking for a solution, make sure:
bindirectoryE.g.