Node-gyp: "node-gyp configure" fails with ECONNRESET error.

Created on 4 Jan 2017  ·  10Comments  ·  Source: nodejs/node-gyp

npm install -g node-gyp was successful but node-gyp configure throws the error below. Trying to upgrade node version in our application.

Mine is a Windows 7 64 bit machine.

D:\App>node-gyp configure
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp http GET https://nodejs.org/download/release/v6.9.2/node-v6.9.2-headers.tar.gz
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: read ECONNRESET
gyp ERR! stack at exports._errnoException (util.js:1022:11)
gyp ERR! stack at TLSWrap.onread (net.js:569:26)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\XXXX\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.j
s" "configure"
gyp ERR! cwd D:\IMVNode new version\IMV
gyp ERR! node -v v6.9.2
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok

Most helpful comment

You can work around this by downloading the node source tarball from https://nodejs.org/download/release/v6.9.5/ and directing node-gyp to use it instead of trying to download it, by setting export npm_config_tarball=PATH_OF_TARBALL or npm config set npm_config_tarball PATH_OF_TARBALL

FYI the tarball option won't work for Windows users, as node-gyp will try to download the node.lib files separately.


If you've installed node and npm you already have node-gyp installed (it's a dependency of npm), you just need the headers.

Assuming you're using node v6.10.1:

Headers are stored in ~/.node-gyp/6.10.1/ (or %USERPROFILE%\.node-gyp on windows), you also need the installVersion file. In later versions of node-gyp these files could change, check the contents of ~/.node-gyp on a machine with internet access when you run npm i -g node-gyp && node-gyp configure and duplicate it.

curl -O https://nodejs.org/dist/v6.10.1/node-v6.10.1-headers.tar.gz # on a computer with internet
curl -O https://nodejs.org/dist/v6.10.1/win-x64/node.lib # Windows 64-bit only
curl -O https://nodejs.org/dist/v6.10.1/win-x86/node.lib # Windows 32-bit only
# Copy header tarball to offline machine
mkdir -p  ~/.node-gyp/6.10.1
tar -xf node-v6.10.1-headers.tar.gz --directory ~/.node-gyp/6.10.1/ --strip-components 1
echo 9 >~/.node-gyp/6.10.1/installVersion

Basically the contents of ~/.node-gyp or %USERPROFILE%\.node-gyp should look like this:

6.10.1
├── include # Contains downloaded headers
└── installVersion # File, content is the number 9
└── x64 # Contains 64-bit node.lib (windows only)
└── ia32 # Contains 32-bit node.lib (windows only)
└── Release # Contains 64-bit node.lib (windows only)

npm install of native modules should now work.

All 10 comments

+1 Same issue here on Ubuntu 14.04

gyp info it worked if it ends with ok
gyp verb cli [ '/usr/bin/nodejs', '/usr/bin/node-gyp', 'rebuild', '--verbose' ]
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb which succeeded python2 /usr/bin/python2
gyp verb check python version /usr/bin/python2 -c "import platform; print(platform.python_version());" returned: "2.7.6\n"
gyp verb get node dir no --target version specified, falling back to host node version: 6.9.4
gyp verb command install [ '6.9.4' ]
gyp verb install input version string "6.9.4"
gyp verb install installing version: 6.9.4
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 6.9.4
gyp verb ensuring nodedir is created /home/vagrant/.node-gyp/6.9.4
gyp verb created nodedir /home/vagrant/.node-gyp/6.9.4
gyp http GET https://nodejs.org/download/release/v6.9.4/node-v6.9.4-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v6.9.4/node-v6.9.4-headers.tar.gz
gyp verb extracted file from tarball include/node/android-ifaddrs.h
gyp verb extracted file from tarball include/node/ares.h
gyp verb extracted file from tarball include/node/ares_build.h
gyp verb extracted file from tarball include/node/ares_rules.h
gyp verb extracted file from tarball include/node/ares_version.h
gyp verb extracted file from tarball include/node/common.gypi
gyp verb extracted file from tarball include/node/config.gypi
gyp verb extracted file from tarball include/node/nameser.h
gyp verb extracted file from tarball include/node/node.h
gyp verb extracted file from tarball include/node/node_buffer.h
gyp verb extracted file from tarball include/node/node_object_wrap.h
gyp verb extracted file from tarball include/node/node_version.h
gyp verb extracted file from tarball include/node/pthread-barrier.h
gyp verb extracted file from tarball include/node/pthread-fixes.h
gyp verb extracted file from tarball include/node/stdint-msvc2008.h
gyp verb extracted file from tarball include/node/tree.h
gyp verb extracted file from tarball include/node/uv-aix.h
gyp verb extracted file from tarball include/node/uv-bsd.h
gyp verb extracted file from tarball include/node/uv-darwin.h
gyp verb extracted file from tarball include/node/uv-errno.h
gyp verb extracted file from tarball include/node/uv-linux.h
gyp verb extracted file from tarball include/node/uv-sunos.h
gyp verb extracted file from tarball include/node/uv-threadpool.h
gyp verb extracted file from tarball include/node/uv-unix.h
gyp verb extracted file from tarball include/node/uv-version.h
gyp verb extracted file from tarball include/node/uv-win.h
gyp verb extracted file from tarball include/node/uv.h
gyp verb extracted file from tarball include/node/v8-debug.h
gyp verb extracted file from tarball include/node/v8-experimental.h
gyp verb extracted file from tarball include/node/v8-platform.h
gyp verb extracted file from tarball include/node/v8-profiler.h
gyp verb extracted file from tarball include/node/v8-testing.h
gyp verb extracted file from tarball include/node/v8-util.h
gyp verb extracted file from tarball include/node/v8-version.h
gyp verb extracted file from tarball include/node/v8.h
gyp verb extracted file from tarball include/node/v8config.h
gyp verb extracted file from tarball include/node/zconf.h
gyp verb extracted file from tarball include/node/zlib.h
gyp verb extracted file from tarball include/node/openssl/aes.h
gyp verb extracted file from tarball include/node/openssl/asn1.h
gyp WARN install got an error, rolling back install
gyp verb command remove [ '6.9.4' ]
gyp verb remove using node-gyp dir: /home/vagrant/.node-gyp
gyp verb remove removing target version: 6.9.4
gyp verb remove removing development files for version: 6.9.4
gyp verb extracted file from tarball include/node/openssl/asn1_mac.h
gyp ERR! configure error
gyp ERR! stack Error: read ECONNRESET
gyp ERR! stack at exports._errnoException (util.js:1022:11)
gyp ERR! stack at TLSWrap.onread (net.js:569:26)
gyp ERR! System Linux 3.13.0-100-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/bin/node-gyp" "rebuild" "--verbose"
gyp ERR! cwd /var/www/puphpet/files/exec-once
gyp ERR! node -v v6.9.4
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok

@YaminiManthena1 @spectravp are you seeing those under VirtualBox?

Same. My error is coming from a docker container on Cloud Foundry.

   > [email protected] install /tmp/app/node_modules/kerberos
   > (node-gyp rebuild) || (exit 0)

   gyp ERR! configure error
   gyp ERR! stack Error: read ECONNRESET
   gyp ERR! stack     at exports._errnoException (util.js:1022:11)
   gyp ERR! stack     at TLSWrap.onread (net.js:569:26)
   gyp ERR! System Linux 4.4.0-71-generic
   gyp ERR! command "/tmp/app/.heroku/node/bin/node" "/tmp/app/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
   gyp ERR! cwd /tmp/app/node_modules/kerberos
   gyp ERR! node -v v6.9.5
   gyp ERR! node-gyp -v v3.4.0
   gyp ERR! not ok

   > [email protected] install /tmp/app/node_modules/ursa
   > node-gyp rebuild

   gyp ERR! configure error
   gyp ERR! stack Error: read ECONNRESET
   gyp ERR! stack     at exports._errnoException (util.js:1022:11)
   gyp ERR! stack     at TLSWrap.onread (net.js:569:26)
   gyp ERR! System Linux 4.4.0-71-generic
   gyp ERR! command "/tmp/app/.heroku/node/bin/node" "/tmp/app/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
   gyp ERR! cwd /tmp/app/node_modules/ursa
   gyp ERR! node -v v6.9.5
   gyp ERR! node-gyp -v v3.4.0
   gyp ERR! not ok

@bzoz You had an idea?

@justinmoninger it seems like either Docker or "Cloud Foundry" is breaking your TLS connection, that might happen if they have a filter that stops the TLS handshake. Or those systems have an old CA.

You can work around this by downloading the node source tarball from https://nodejs.org/download/release/v6.9.5/ and directing node-gyp to use it instead of trying to download it, by setting export npm_config_tarball=PATH_OF_TARBALL or npm config set npm_config_tarball PATH_OF_TARBALL

@bzoz You had an idea?

I assume @bzoz suspected the bug he mentioned here https://github.com/nodejs/node/issues/10286#issuecomment-297044464

Exactly

You can work around this by downloading the node source tarball from https://nodejs.org/download/release/v6.9.5/ and directing node-gyp to use it instead of trying to download it, by setting export npm_config_tarball=PATH_OF_TARBALL or npm config set npm_config_tarball PATH_OF_TARBALL

FYI the tarball option won't work for Windows users, as node-gyp will try to download the node.lib files separately.


If you've installed node and npm you already have node-gyp installed (it's a dependency of npm), you just need the headers.

Assuming you're using node v6.10.1:

Headers are stored in ~/.node-gyp/6.10.1/ (or %USERPROFILE%\.node-gyp on windows), you also need the installVersion file. In later versions of node-gyp these files could change, check the contents of ~/.node-gyp on a machine with internet access when you run npm i -g node-gyp && node-gyp configure and duplicate it.

curl -O https://nodejs.org/dist/v6.10.1/node-v6.10.1-headers.tar.gz # on a computer with internet
curl -O https://nodejs.org/dist/v6.10.1/win-x64/node.lib # Windows 64-bit only
curl -O https://nodejs.org/dist/v6.10.1/win-x86/node.lib # Windows 32-bit only
# Copy header tarball to offline machine
mkdir -p  ~/.node-gyp/6.10.1
tar -xf node-v6.10.1-headers.tar.gz --directory ~/.node-gyp/6.10.1/ --strip-components 1
echo 9 >~/.node-gyp/6.10.1/installVersion

Basically the contents of ~/.node-gyp or %USERPROFILE%\.node-gyp should look like this:

6.10.1
├── include # Contains downloaded headers
└── installVersion # File, content is the number 9
└── x64 # Contains 64-bit node.lib (windows only)
└── ia32 # Contains 32-bit node.lib (windows only)
└── Release # Contains 64-bit node.lib (windows only)

npm install of native modules should now work.

Answered, closing.

gyp ERR! install error
gyp ERR! stack Error: read ECONNRESET
gyp ERR! stack at exports._errnoException (util.js:1022:11)
gyp ERR! stack at TLSWrap.onread (net.js:569:26)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\Users\FOST001GEO018\AppData\Local\atom\app-1.23.2\re
sources\app\apm\bin\node.exe" "C:\Users\FOST001GEO018\AppData\Local\ato
m\app-1.23.2\resources\app\apm\node_modules\node-gyp\bin\node-gyp.js" "i
nstall" "--runtime=electro

gyp ERR! install error
gyp ERR! stack Error: read ECONNRESET
gyp ERR! stack at exports._errnoException (util.js:1022:11)
gyp ERR! stack at TLSWrap.onread (net.js:569:26)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\Users\FOST001GEO018\AppData\Local\atom\app-1.23.2\re
sources\app\apm\bin\node.exe" "C:\Users\FOST001GEO018\AppData\Local\ato
m\app-1.23.2\resources\app\apm\node_modules\node-gyp\bin\node-gyp.js" "i
nstall" "--runtime=electron" "--target=1.6.15" "--dist-url=https://atom.io/downl
oad/electron" "--arch=ia32" "--ensure"
gyp ERR! cwd C:\Users\FOST001GEO018.atom
gyp ERR! node -v v6.9.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok

similar error with browser plus

Was this page helpful?
0 / 5 - 0 ratings