So I'm learning node.js. I am following this tutorial to install it and try some things.
Anyway, npm behaves really weird. It will work fine for a while (I changed its viewer configuration settings, for example), but then it suddenly “disappears”, so the next time I enter
npm ...(anything)
on the command line, my shell tells me that the npm command was not found. Uninstalling and then reinstalling npm using nvm used to work, but I would prefer not to do it every ten minutes, and it’s very strange for me that it suddenly stops working.
I think the last time it stopped working after I edited and then processed the ~ / .zshrc file - just added npm and node tab completion plugins.
Any idea what is going on? I will post the results of a few basic commands, but I am really poor at sysadmin, and I really don't know what to look for here.
nvm -ls
v0.8.22
current: v0.10.2
default -> 0.8 (-> v0.8.22)
which node
/usr/bin/node
where npm
npm not found
My root folder has both nvm (is it a duplicate?) And npm directories.
If I go to / usr / bin, node is a file, not a directory. There is also an npm file, but not an nvm file.
As can be seen from all of the above, I really do not know what is happening. I was looking for this, but it seems this problem is not. Any ideas on what's going on or how to find out?
EDIT , default node , . , bin ( github - , ), - ?:
➜ node nvm alias default v0.10.2
default -> v0.10.2
➜ node nvm ls
v0.8.22
current: v0.10.2
default -> v0.10.2
➜ node npm
zsh: command not found: npm
➜ node nvm install npm
100.0%
Checksums do not match.
Binary download failed, trying source.
Additional options while compiling:
nvm: install N/A failed!
➜ bin git:(master) nvm uninstall npm
N/A version is not installed yet... installing
100.0%
Checksums do not match.
Binary download failed, trying source.
Additional options while compiling:
nvm: install N/A failed!
➜ bin git:(master) cd ~/rails/node
EDIT 2 - , node zshrc:
export PATH=(...):/usr/bin/node
source ~./zshrc
:
.zshrc:11: command not found: npm
( ):
10 . ~/nvm/nvm.sh
11 . <(npm completion)
, , npm, , .
Jens
~/nvm/nvm.sh, :
if [ ! -d "$NVM_DIR" ]; then
export NVM_DIR=$(cd $(dirname ${BASH_SOURCE[0]:-$0}) && pwd)
fi
if [ ! -z "$(which unsetopt 2>/dev/null)" ]; then
unsetopt nomatch 2>/dev/null
fi
(, , ) chmod npm, //.