I got similar error also on Windows 8 after I have just upgraded node js. First: how I ran into the issue then the solution that worked for bủ.
How I ran to tát the issue: When I did npm --version and node --version I discovered that I wass running npm v3.x and node 5.x. So I went to tát nodejs.org site from where I downloaded node-v8.11.3-x64.msi. After installing the msi package I confirmed that my nodejs version was now v8.11.3 via node --version command.
Then, when I ran "npm install http-server" (w/o the quotes) that's when I got the issue:
npm ERR! node v8.11.3 npm ERR! npm v3.5.3 npm ERR! code MODULE_NOT_FOUND
My resolution: I did some research including on the mạng internet and found out that the npm version pointed to tát in my path was the one in my roaming profile C:\Users[myname.hostname]\AppData\Roaming\npm. In other words, the npm being used is not the one in the updated package I have just installed which is located in C:\Program Files\nodejs.
The resolution was to tát delete npm and npm-cache in the roaming thư mục. Note, I used cygwin as I was not able to tát delete these folders via Windows cmd prompt. With cygwin, I navigated to tát
cd "C:\Users[myname.hostname]\AppData\Roaming"
Then I removed the aforementioned folders lượt thích so
rm -rf npm-cache rm -rf npm
After that, I opened a new Windows cmd prompt and was able to tát now successfully install http-server lượt thích so:
npm install http-server
Hope this works for you.