How to install bower on centos 7

geeks picture geeks · Jul 17, 2015 · Viewed 9.9k times · Source

I am trying to install bower on centos7, after installing nodejs. To install nodejs I follows these steps

Step1: wget http://nodejs.org/dist/v0.10.30/node-v0.10.30.tar.gz

Step2: tar xzvf node-v* && cd node-v*

Step3: sudo yum install gcc gcc-c++

Step4: ./configure

Step5: make

Step6: sudo make install

Step7: node --version

I had successfully installed nodejs, I follows this steps from Install Nodejs

Then install npm by running command sudo yum install npm.

Now I am trying to install bower So I run the following command npm install -g bower. But getting the following error. Please tell me how to install bower correctly.

[neelabh@localhost node-v0.12.7]$ npm install -g bower
npm ERR! tar.unpack untar error /home/neelabh/.npm/bower/1.4.1/package.tgz
npm ERR! Linux 3.10.0-123.el7.x86_64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "bower"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! path /usr/local/lib/node_modules/bower
npm ERR! code EACCES
npm ERR! errno -13

npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/bower'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES, mkdir '/usr/local/lib/node_modules/bower']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/usr/local/lib/node_modules/bower',
npm ERR!   fstream_type: 'Directory',
npm ERR!   fstream_path: '/usr/local/lib/node_modules/bower',
npm ERR!   fstream_class: 'DirWriter',
npm ERR!   fstream_stack: 
npm ERR!    [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:35:25',
npm ERR!      '/usr/local/lib/node_modules/npm/node_modules

/mkdirp/index.js:47:53', npm ERR! 'FSReqWrap.oncomplete (fs.js:95:15)' ] } npm ERR! npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/neelabh/Downloads/Softwares/node-v0.12.7/npm-debug.log

Answer

Uder Moreira picture Uder Moreira · Sep 22, 2015

try:

sudo yum update -y

sudo yum install -y epel-release gcc gcc-c++ git libtool-ll libtool-ltdl-devel lsof make unixODBC unixODBC-devel wget

sudo yum install -y nodejs npm --enablerepo=epel

sudo npm install -g node-gyp bower

Check your internet connectivity (Are you under a proxy?). It may need additional steps to solve internet issues.