453wgq
Last Updated: February 25, 2016
·
23.18K
· harshadkale
Dsc 0209 001  10

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!

  1. Run 'cmd' as Administrator

  2. Make sure your PATH environment variable points to the right location of nodejs, typically C:\Program Files\nodejs.

  3. Back to cmd, cd into (go to) C:\Program Files\nodejs\nodemodules\npm\nodemodules

  4. Clear npm cache by npm cache clear

  5. Run command npm install {package_name} -g - it could be Express, Jade etc. It will create a package folder in current location.

  6. 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.

  7. 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.

  8. 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.

4 Responses
Add your response

8411
31eb6a8956e2e604319b3f59f60d49f4

Thanks, I had the same on vindows 7, you helped me.

over 1 year ago ·
8542
Dsc 0209 001  10

Glad to hear that

over 1 year ago ·
8609

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.)

over 1 year ago ·
23071
0  gms3n0g4wdtxaext6nsdzjgxsetscowygnixi3gz4bhstzkbqvdw1sgu4sym8qwyp4dw1vca7s8y6jqulwldcnmn7s3yqpkulwmg t xm7snkf4chjhcc7tqv8azqwv  ft5juzgul

How to run and start that project on windows that built

over 1 year ago ·