VMWare Workstation start on boot CentOS

Installing npm using install.sh on CentOS 6.3

npm

Prerequisites

you need to have Node.js installed, configured and working.
How to install Node.js on centos 6.3.
also, check you have curl installed:
[code lang=”bash”]yum install curl[/code]

The problem

npm can be installed using rpm or repo but there are situations where you might want to install npm using the install.sh script.
CentOS minimal doesn’t include the ‘which’ command.

npm install.sh patch

because the install.sh script uses the command ‘which‘, you need to create a patch.
create a ‘which’ file in your /bin directory and add inside:

[code lang=”bash”]#!/bin/bash
whereis $1 | cut -d ” ” -f2[/code]

and run:

[code lang=”bash”]cd /bin
alias which=./which
chmod +x which[/code]

check with ‘which node’ which should return ‘/usr/bin/node’ if you installed node.js using the rpm or repo.

finally, run the following:
[code lang=”bash”]cd /tmp
curl -s http://npmjs.org/install.sh > npm-install-$$.sh
sh npm-install-xxxx.sh[/code]

For me, it was npm-install-4691.sh, but it could be with other name.

 

You can now use the install.sh script on your CentOS minimal.

Happy coding.

Leave a Reply

Your email address will not be published.

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.