Running npm install through2-map and getting a ECONNREFUSED error

On Cloud9, I’m running npm install through2-map and getting a ECONNREFUSED error. I’ve tried a number of things based on google searches but no success. The error:

witcradg:~/workspace $ npm install through2-map
npm ERR! Linux 4.2.0-c9
npm ERR! argv “/home/ubuntu/.nvm/versions/node/v4.4.5/bin/node” “/home/ubuntu/.nvm/versions/node/v4.4.5/bin/npm” “install” "through2-map"
npm ERR! node v4.4.5
npm ERR! npm v3.10.5
npm ERR! syscall connect

npm ERR! Error: connect ECONNREFUSED
npm ERR! at Object.exports._errnoException (util.js:870:11)
npm ERR! at exports._exceptionWithHostPort (util.js:893:20)
npm ERR! at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1061:14)
npm ERR! { [Error: connect ECONNREFUSED]
npm ERR! code: ‘ECONNREFUSED’,
npm ERR! errno: ‘ECONNREFUSED’,
npm ERR! syscall: ‘connect’,
npm ERR! address: ‘’,
npm ERR! port: 15443 }
npm ERR!
npm ERR! If you are behind a proxy, please make sure that the
npm ERR! ‘proxy’ config is set properly. See: ‘npm help config’

npm ERR! Please include the following file with any support request:
npm ERR! /home/ubuntu/workspace/npm-debug.log

Things I’ve tried:
npm install -g through2-map
sudo npm install through2-map
npm clear cache
I’ve made sure I don’t have node running
ps -ef | grep node

I get an installation when I do sudo npm install -g through2-map but the require statement cannot find it:
witcradg:~/workspace $ learnyounode run program.js
throw err;

Error: Cannot find module 'through2-map’
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/home/ubuntu/workspace/program.js:2:11)
at Module._compile (module.js:409:26)
at Object.Module._extensions…js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
✗ Error connecting to http://localhost:21110:

witcradg:~/workspace $ head program.js
var http = require(“http”);
var map = require(“through2-map”);

I was able to successfully install by creating a new project. “npm install through2-map” just worked.

1 Like

thanks a lot for reporting it back after you found the solution.
I had a similar issue, it solved the problem for me.

created a new folder,
ran npm init
then npm install through2-map

and surprisingly it solved the problem

Why do we really have a create a new project for this to work? I dont want to create a new project because my current project workspace is a local git repo. Please how can this work without having to create a new project?