Cannot install through2-map

Problem

When I try to install through2-map using the command:

user1@ubuntu:~/nodetest1$ npm install through2-map

I get error message:

npm ERR! Error: Cannot find module 'request'
npm ERR!     at Function.Module._resolveFilename (module.js:331:15)
npm ERR!     at Function.Module._load (module.js:273:25)
npm ERR!     at Module.require (module.js:357:17)
npm ERR!     at require (module.js:373:17)
npm ERR!     at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/fetch.js:5:15)
npm ERR!     at Module._compile (module.js:449:26)
npm ERR!     at Object.Module._extensions..js (module.js:467:10)
npm ERR!     at Module.load (module.js:349:32)
npm ERR!     at Function.Module._load (module.js:305:12)
npm ERR!     at Module.require (module.js:357:17)
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Linux 3.8.0-34-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "through2-map"
npm ERR! cwd /home/user1/nodetest1
npm ERR! node -v v0.11.10-pre
npm ERR! npm -v 1.3.15
npm ERR! code MODULE_NOT_FOUND
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/user1/nodetest1/npm-debug.log
npm ERR! not ok code 0

I am new to node and have no idea why is this happening or how can I solve it. Please help

UPDATE: Additional messages from npm-debug file

user1@ubuntu:~/nodetest1$ cat /home/user1/nodetest1/npm-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'install',
1 verbose cli   'through2-map' ]
2 info using npm@1.3.15
3 info using node@v0.11.10-pre
4 error Error: Cannot find module 'request'
4 error     at Function.Module._resolveFilename (module.js:331:15)
4 error     at Function.Module._load (module.js:273:25)
4 error     at Module.require (module.js:357:17)
4 error     at require (module.js:373:17)
4 error     at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/fetch.js:5:15)
4 error     at Module._compile (module.js:449:26)
4 error     at Object.Module._extensions..js (module.js:467:10)
4 error     at Module.load (module.js:349:32)
4 error     at Function.Module._load (module.js:305:12)
4 error     at Module.require (module.js:357:17)
5 error If you need help, you may report this log at:
5 error     <http://github.com/isaacs/npm/issues>
5 error or email it to:
5 error     <npm-@googlegroups.com>
6 error System Linux 3.8.0-34-generic
7 error command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "through2-map"
8 error cwd /home/user1/nodetest1
9 error node -v v0.11.10-pre
10 error npm -v 1.3.15
11 error code MODULE_NOT_FOUND
12 verbose exit [ 1, true ]
user1@ubuntu:~/nodetest1$ 
Problem courtesy of: user3043457

Solution

You built this from source from the latest unreleased code on the unstable branch of node.js, followed by a failed upgrade of node using npm. This may be a bug, or a problem introduced through an unusual upgrade performed on a pre-release version of the code.

Unless you need facilities in 0.11.x I would strongly recommend you use the latest stable release 0.10.22.

The most recent stable version is always shown prominently on the node.js website.

If you want (or need to) build from source, once you've cloned the repo, you can use

git checkout v0.10.22

To get the right version before building.

If you want to switch around versions, I would also recommend using node version manager:

https://github.com/creationix/nvm

Solution courtesy of: iandotkelly

Discussion

There is currently no discussion for this recipe.

This recipe can be found in it's original form on Stack Over Flow.