VMWare Workstation start on boot CentOS

Fix cannot find module ‘block-stream’’ in npm Node.js on CentOS 6.3


While writing  and exploring on Node.js I did lots of ‘yum remove/install’ for npm node.js.
after a while I realized that npm wasn’t installing anything and just returned an Error: cannot find module ‘block-stream’.
Another thing was that the folder ‘/usr/lib/nodejs/npm’ was lacking the ‘node_modules’ folder which includes its dependencies.
yum remove/install npm didn’t helped, the error also happened when I tried running ‘npm update’ or ‘npm install’.


With the help of a few great guys from #Node.js it seems that the current 1.1.44 version of npm might have a bug in the rpm package and that the package is broken on my CentOS.
If you experience it either use the ‘npm-install‘ script instead of yum.


CentOS minimal don’t have the command ‘which‘ which the install script of npm uses during run-time, and because of that you’ll need to create a patch for ‘which’ command. (thanks again marcosnils 😉 )

EDIT: CentOS always had which, I was dumb to override it with the following patch. fix your which, and try the following solution ONLY if you can’t. then REMEMBER to delete the WHICH script below after the installation OR ELSE your future ‘yum install kernel’ will fail.

Which command patch

add a file named ‘which’ in your /bin directory and add inside:

whereis $1 | cut -d " " -f2

now run:

cd /bin
chmod +x which

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

if you don’t have whereis installed just run:

yum install whereis

Install npm

finally, run the following:

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 might have another name.

‘npm update’ and/or ‘npm install’ should work for you again now, as it did for me. if not, you can try to

yum remove npm

and then install npm again using

yum install npm



REMEMBER – AFTER YOU FINISH INSTALLING – REMOVE THE ‘WHICH’ script in the /bin folder we’ve added. It will KILL your ‘yum update kernel’!!! . it took me almost 2 years to find out it’s the source of my ‘yum update kernel’ kernel panics!


if you need help with installing Node.js on Centos – read this


A little bonus: Now you can install npm using the npm-install script which did not work on CentOS without the ‘which’ mod. 😉


Development Specialist, Artist and Activist
Personal Website

One thought on “Fix cannot find module ‘block-stream’’ in npm Node.js on CentOS 6.3

  1. remodeling

    You really make it seem so easy with your presentation but I find
    this matter to be really something that I think I would never
    understand. It seems too complicated and very broad for me.
    I am looking forward for your next post, I will try to get the hang of it!


Leave a Reply

Your email address will not be published.