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:

1
yum install curl
yum install curl

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:

1
2
#!/bin/bash
whereis $1 | cut -d " " -f2
#!/bin/bash
whereis $1 | cut -d " " -f2

and run:

1
2
3
cd /bin
alias which=./which
chmod +x which
cd /bin
alias which=./which
chmod +x which

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

finally, run the following:

1
2
3
cd /tmp
curl -s http://npmjs.org/install.sh > npm-install-$$.sh
sh npm-install-xxxx.sh
cd /tmp
curl -s http://npmjs.org/install.sh > npm-install-$$.sh
sh npm-install-xxxx.sh

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. Required fields are marked *

*

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