How to install npm for node.js installed using homebrew installed on custom path?

I am using Mac OS X Lion 10.7 and installed homebrew with an alternative installation on a user path in order to save it in a user area that does not require sudo . I installed node.js successfully. But npm not installed.

 Last login: Tue Nov 29 10:26:51 on ttys003 Hoons-MacBook-Air:~ Eonil$ node --version v0.6.2 Hoons-MacBook-Air:~ Eonil$ node > (^C again to quit) > Hoons-MacBook-Air:~ Eonil$ curl http://npmjs.org/install.sh | sh % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 7184 100 7184 0 0 4581 0 0:00:01 0:00:01 --:--:-- 19363 npm cannot be installed without nodejs. Install node first, and then try again. Maybe node is installed, but not in the PATH? Note that running as sudo can change envs. PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:~/Unix/homebrew/bin Hoons-MacBook-Air:~ Eonil$ ls ~/Unix/homebrew/bin/ brew node node-waf Hoons-MacBook-Air:~ Eonil$ 

I see that the path to the node binary is being added to the $PATH variable. I don't know why npm complains. How can i install it?

+4
source share
2 answers

I got a response from the Stackoverlow / Unix and Linux page.

https://unix.stackexchange.com/questions/25605/how-to-add-home-directory-path-to-be-discovered-by-unix-which-command

The main problem was that the system does not extend the ~ home directory character. So I had to set the absolute directory using the $HOME environment variable.

+4
source

I'm not sure. But try adding node to /usr/local/bin as shown below.

 ln -s /usr/local/bin/node ~/Unix/homebrew/bin/node 
0
source

Source: https://habr.com/ru/post/1383542/


All Articles