Closed SimenB closed 8 years ago
Sorry a bit confused, when did you get npm not found
, after you installed npm?
Ok, found the issue, for some insane reason npm
gets ignored when node
and npm
are the only binaries. For example:
% ls $NVM_DIR/versions/*/*/bin/*(N)
/Users/lukechilds/.lazyload-test/versions/node/v6.4.0/bin/node
/Users/lukechilds/.lazyload-test/versions/node/v6.4.0/bin/npm
% ls $NVM_DIR/versions/*/*/bin/*(N) | xargs basename
node
But then if you install a module:
% ls $NVM_DIR/versions/*/*/bin/*(N)
/Users/lukechilds/.lazyload-test/versions/node/v6.4.0/bin/node
/Users/lukechilds/.lazyload-test/versions/node/v6.4.0/bin/npm
/Users/lukechilds/.lazyload-test/versions/node/v6.4.0/bin/package
% ls $NVM_DIR/versions/*/*/bin/*(N) | xargs basename
node
npm
package
Working on a fix...
Doh! Just needed to set max-args
to 1 on xargs
:
% ls $NVM_DIR/versions/*/*/bin/*(N)
/Users/lukechilds/.lazyload-test/versions/node/v6.4.0/bin/node
/Users/lukechilds/.lazyload-test/versions/node/v6.4.0/bin/npm
% ls $NVM_DIR/versions/*/*/bin/*(N) | xargs basename
node
% ls $NVM_DIR/versions/*/*/bin/*(N) | xargs -n1 basename
node
npm
Should be fixed as of https://github.com/lukechilds/zsh-nvm/commit/1be9149af66b7324adbfff0d43287f463009b194. which npm
now works after a fresh install:
% which npm
npm () {
unset -f node npm nvm
_zsh_nvm_load
npm "$@"
}
Thanks for taking the time to report 👍
No problem, thanks for the quick fix!
I think this is the issue, not sure though...
I set this up on my work machine, and just
nvm install 6.4
gives the following fromwhich node
in a new shell:Running
npm i -g npm
then a new session made no difference. I then installednpm-check-update
andtypings
, which gave me:which npm
gave menpm not found
up until the last one.Not sure why, but maybe it'll give you a starting point for where to look 😄