installing npm packages on Windows
UPDATE - NO NEED TO FOLLOW THIS TIP NOW. NODE SINCE VERSIONS > 0.6 INSTALL NPM ALONG WITH ITSELF
If you are trying to install nom packages on Windows, you will face all sorts of problems.
My machine configuration -
Microsoft Windows 8 Release Preview
While executing "npm install express" and then "npm install" it always threw me an error saying that the dependencies cannot be read. I followed a few logical steps and now it works. I am not sure exactly what part of my steps fixed it, but if you have these problems, worth trying!
Run 'cmd' as Administrator
Make sure your PATH environment variable points to the right location of nodejs, typically C:\Program Files\nodejs.
Back to cmd, cd into (go to) C:\Program Files\nodejs\nodemodules\npm\nodemodules
Clear npm cache by npm cache clear
Run command npm install {package_name} -g - it could be Express, Jade etc. It will create a package folder in current location.
It will create folders under C:\Users{yourusername}\AppDate\Roaming\npm\nodemodules. Copy paste all the folders under this node_modules to C:\Program Files\nodejs\nodemodules\npm\nodemodules.
Add entry of the dependencies (of the packages you want to install in the package.json under C:\Program Files\nodejs\node_modules\npm\package.json as
"express": "{version}",
This latest version can be found out by running npm info express version on cmd.cd into (go into) that created package folder and run npm install -g (-g installs it globally)
Done!
I am sure there is easier way to do all this and the way I did may not be the appropriate way, rather it is not. But I do not know any other way so, this should work for you too.
If you happen to know easier and appropriate way, you are more than welcome to describe it in the comments below.
Written by Harshad Kale
Related protips
4 Responses
Thanks, I had the same on vindows 7, you helped me.
Glad to hear that
Just a note to add, in case others are running into this: "nodemodules" should be "node_modules" in the path. This looks to be the result of writing the original post in markdown (what is between undersores is italicized.)
How to run and start that project on windows that built