phusion / node-sha3

SHA3 for JavaScript - The Keccak family of hash algorithms

Home Page:https://www.npmjs.com/package/sha3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failed at the sha3@1.2.0 install script 'node-gyp rebuild'.

domu904 opened this issue · comments

I was trying to install Truffle and I got the following error:

node-sass@3.8.0 postinstall /usr/lib/node_modules/truffle/node_modules/truffle-default-builder/node_modules/node-sass
node scripts/build.js

"/usr/lib/node_modules/truffle/node_modules/truffle-default-builder/node_modules/node-sass/vendor/linux-x64-46/binding.node" exists.
testing binary.
Binary is fine; exiting.
npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "truffle"
npm ERR! node v4.5.0
npm ERR! npm v2.15.9
npm ERR! code ELIFECYCLE

npm ERR! sha3@1.2.0 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sha3@1.2.0 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the sha3 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs sha3
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls sha3
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/user/Projects/WeatherContractBlock/npm-debug.log

Adding npm log file

npm-debug.log.zip

I am installing this on Debian with Node v4

commented

Same to me

Same problem here too

Hi,

I've hit a roadblock with installing Truffle on my local (win 7) machine too. I am using npm v2.15.9 and node v4.6.1, these are the same version as the ethereum studio VM where I managed to install Truffle. Locally I am getting the following issues:

267977 verbose stack Error: sha3@1.2.0 install: `node-gyp rebuild`
267977 verbose stack Exit status 1
267977 verbose stack     at EventEmitter.<anonymous> (C:\Users\ahmedim\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:217:16)
267977 verbose stack     at emitTwo (events.js:87:13)
267977 verbose stack     at EventEmitter.emit (events.js:172:7)
267977 verbose stack     at ChildProcess.<anonymous> (C:\Users\ahmedim\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:24:14)
267977 verbose stack     at emitTwo (events.js:87:13)
267977 verbose stack     at ChildProcess.emit (events.js:172:7)
267977 verbose stack     at maybeClose (internal/child_process.js:829:16)
267977 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
267978 verbose pkgid sha3@1.2.0
267979 verbose cwd F:\dev
267980 error Windows_NT 6.1.7601
267981 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ahmedim\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "truffle"
267982 error node v4.6.1
267983 error npm  v2.15.9
267984 error code ELIFECYCLE
267985 error sha3@1.2.0 install: `node-gyp rebuild`
267985 error Exit status 1
267986 error Failed at the sha3@1.2.0 install script 'node-gyp rebuild'.
267986 error This is most likely a problem with the sha3 package,
commented

Anyone it's working on this?

commented

same issue here :o

commented

same error on windows 7, latest node.js 6

I had the same issue with sha3. So to diagnose it try running npm install sha3

The error messages were more specific. Turns out I had to install Python 2.7.x (and add to path before Python v3 location)

Hope this can help someone.

I'm running Windows10, Node v7.2.0 and Npm v3.10.9

commented

Resolved : sudo apt-get install build-essential

For Red Hat distributions (for example, CentOS) it will be sudo yum groupinstall 'Development Tools'.

I am also having the same issue. I am trying to run an npm install and one the package dependencies is sha3

I am trying this on ubuntu and amazon linux - same error on both:

$ npm install sha3

> sha3@1.2.0 install /home/ec2-user/faucet/node_modules/sha3
> node-gyp rebuild

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:1026:11)
gyp ERR! stack     at TLSWrap.onread (net.js:563:26)
gyp ERR! System Linux 4.4.35-33.55.amzn1.x86_64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/ec2-user/faucet/node_modules/sha3
gyp ERR! node -v v6.4.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.17: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! Linux 4.4.35-33.55.amzn1.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "sha3"
npm ERR! node v6.4.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! sha3@1.2.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sha3@1.2.0 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the sha3 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs sha3
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls sha3
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/ec2-user/faucet/npm-debug.log

I tried all the suggestions above. Node version 6.9, npm version 3.10.10. My python --version is 2.7.12 and I installed the build-essential package on ubuntu ('Development Tools' on aws-linux). Nothing is working. I need to get this particular module working for my project and am considering forking the npm module to cut out the sha3 dependency.

Pretty desperate here, anyone have any suggestions at all on how to get npm install sha3 to work correctly on ubuntu or any other type of linux??

System Information

Travis:    Trusty image (Linux 4.4.0-51-generic)
node:      6.9.4
node-gyp:  3.4.0
yarn:      0.17.8
sha3:      1.2.0

Restarting the travis build normally helps to finish the build.
Though this happens on every ~5 build.

[...]
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error /home/travis/build/ethereum/mist/node_modules/sha3: Command failed.
Exit code: 1
Command: sh
Arguments: -c node-gyp rebuild
Directory: /home/travis/build/ethereum/mist/node_modules/sha3
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@3.4.0
gyp info using node@6.9.4 | linux | x64
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp http GET https://nodejs.org/dist/v6.9.4/node-v6.9.4-headers.tar.gz
gyp http 200 https://nodejs.org/dist/v6.9.4/node-v6.9.4-headers.tar.gz
gyp http GET https://nodejs.org/dist/v6.9.4/SHASUMS256.txt
gyp http 200 https://nodejs.org/dist/v6.9.4/SHASUMS256.txt
gyp info spawn /opt/python/2.7.12/bin/python2
gyp info spawn args [ '/usr/local/yarn-0.17.8/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/travis/build/ethereum/mist/node_modules/sha3/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/yarn-0.17.8/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/travis/.node-gyp/6.9.4/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/travis/.node-gyp/6.9.4',
gyp info spawn args   '-Dnode_gyp_dir=/usr/local/yarn-0.17.8/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/travis/build/ethereum/mist/node_modules/sha3',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory `/home/travis/build/ethereum/mist/node_modules/sha3/build'
  CXX(target) Release/obj.target/sha3/src/addon.o
In file included from ../src/addon.cpp:3:0:
/home/travis/.node-gyp/6.9.4/include/node/v8.h:15:0: error: unterminated #ifndef
 #ifndef INCLUDE_V8_H_
 ^
../src/addon.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE SHA3Hash::New(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/addon.cpp:59:58: warning: ‘v8::Local<v8::Object> v8::Function::NewInstance(int, v8::Local<v8::Value>*) const’ is deprecated (declared at /home/travis/.node-gyp/6.9.4/include/node/v8.h:3269): Use maybe version [-Wdeprecated-declarations]
    info.GetReturnValue().Set(cons->NewInstance(argc, argv));
                                                          ^
make: *** [Release/obj.target/sha3/src/addon.o] Error 1
make: Leaving directory `/home/travis/build/ethereum/mist/node_modules/sha3/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/yarn-0.17.8/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.0-51-generic
gyp ERR! command "/home/travis/.nvm/versions/node/v6.9.4/bin/node" "/usr/local/yarn-0.17.8/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/travis/build/ethereum/mist/node_modules/sha3
gyp ERR! node -v v6.9.4
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok

Same issue I've hit a roadblock with installing Truffle on my local (win 7) :

124447 error Windows_NT 6.1.7601
124448 error argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "truffle"
124449 error node v6.9.1
124450 error npm v3.10.8
124451 error code ELIFECYCLE
124452 error sha3@1.2.0 install: node-gyp rebuild
124452 error Exit status 1
124453 error Failed at the sha3@1.2.0 install script 'node-gyp rebuild'.
124453 error Make sure you have the latest version of node.js and npm installed.
124453 error If you do, this is most likely a problem with the sha3 package,
124453 error not with npm itself.
124453 error Tell the author that this fails on your system:
124453 error node-gyp rebuild
124453 error You can get information on how to open an issue for this project with:
124453 error npm bugs sha3
124453 error Or if that isn't available, you can get their info via:
124453 error npm owner ls sha3
124453 error There is likely additional logging output above.
124454 verbose exit [ 1, true ]

I have the same issue, installing windows build tools (build essential for windows) did not resolve the problem. Did someone succeeded to make npm install sha3 work on windows ?

I'm also experiencing this issue, on both travis-ci and heroku.

Not sure if this will help anyone else, but switching to Node 6.x fixed this issue for me. Previously our builds were using Node 7.x (latest stable build) and I so far have not found a workaround for this in Node 7.

sudo apt-get install libgmp-dev solved the issue for me

This issue is still open. None of the above suggestions work. Mine is identical to the original problem reported by domu904.

for me it failed on windows because:

npm install sha3
...
\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Python executable "E:\Python\python.EXE" is v3.6.1, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
gyp ERR! stack     at failPythonVersion (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js

So I uninstalled mine and installed 2.7 https://www.python.org/download/releases/2.7/
Then it worked.

gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "f:\ProgramData\Anaconda3\python.EXE", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder. (D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at D:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "D:\Program Files\nodejs\node.exe" "D:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Projects\browser-solidity\node_modules\sha3
gyp ERR! node -v v8.2.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

For those using arch linux, installing the gmp package worked as well (thanks @sduprey )

@luclu Did you ever resolve your issue? unterminated #ifndef? I'm currently seeing this every ~5 builds (same as you), and have not yet determined the cause...

In my package.json, the node version was given as "node": ">=6.4.0". For the 'greater than' sign, in GCP, it was using 8.9.1 version which was causing the issue. Then I fixed it to 6.4.0 by removing the greater than sign, "node": "=6.4.0". This solved my problem.

i managed to solve this for windows 7 and latest npm and node.
I installed Visual Studio Express 2017, which corressponds to version 15.0
but somehow node-gyp supports only up to 14.. or at least hte version i could install

So i had to edit
C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\MSVSVersion.py
and on the bottom

  version_map = {
    'auto': ('15.0','14.0', '12.0', '10.0', '9.0', '8.0', '11.0'),
    '2005': ('8.0',),
    '2005e': ('8.0',),
    '2008': ('9.0',),
    '2008e': ('9.0',),
    '2010': ('10.0',),
    '2010e': ('10.0',),
    '2012': ('11.0',),
    '2012e': ('11.0',),
    '2013': ('12.0',),
    '2013e': ('12.0',),
    '2015': ('14.0',),
    '2017': ('15.0',),
  }

added the
'2017': ('15.0',),
'auto': ('15.0','14.0', '12.0', '10.0', '9.0', '8.0', '11.0'),

AND NOW IT WORKS!

somehow by installing the plain redistributable for .NET 4.7.1 didn't work - it didn't add the registry entries that are described in this file in _DetectVisualStudioVersions

commented

For people still in pain (like I was). I resolved the build error by making sure the g++ command was resolvable. Read: 0mkara/etheratom#88 (comment)

This library is a thin wrapper to a C implementation, using node-gyp to bind the JavaScript interface to the compiled C code. As a result, the downstream requirements of node-gyp propagate to dependency libraries. This goes for any library with native bindings (fsevents, for example).

fsevents, however, is using node-pre-gyp, which may be of some use here as well.

Created #37 to investigate modernizing the compilation toolchain.

I had the same issue. The sha3 package was included in another dependency I have added to my package.json.
I cannot really explain why but the error disappeared after running

npm i sha3 --save
npm i

Hope that helps

I'm still seeing this on ubuntu. I tried the solutions above but the same error just keeps showing up.

I recently came across the viz.js project, which is using Emscripten to compile C for JavaScript with near-native performance. I'll see it this would be feasible for this project. If so, that would achieve the migration off of install-time C compilation steps and all the transitive dependencies that implies.

Resolved : sudo apt-get install build-essential

This saves my day. Thank you.

Closing this as a duplicate of #37, to consolidate the independently reported issues with the install-time compilation steps. Help wanted!

For anyone following this: #44 resolves this issue and is in need of review! Please take a look, review, and/or reach out to security-minded comrades for verification. I know this node-gyp issue has plagued the community for some time, so am excited to finally get it fixed.

commented

I am having the same issue with keccak

I had the same issue. The problem was python3 didn't work, and I had to use python2.

What worked for me was: (Windows 10)

  • Install Python2
  • Add Python2 to PATH
  • Remove Python3 from PATH
  • Restart terminal
    Now I ran 'python' to check that the terminal was reading the python2 version
  • npm install

And then I just changed my PATH back to python3

💡 The latest work toward attempting to address this issue is in #60. As of the time of this comment, I'm still looking for a volunteer more experienced than myself in C and the Node.js add-ons API to fix and maintain the v1.x branch of this package. Until then, please consider v1.x as abandoned and unmaintained, and switch to v2.x if you can, which is actively supported.

Macos:

  1. Install python2 with homebrew https://docs.python-guide.org/starting/install/osx/
  2. Place the python2 path before your other python paths like @mattcrooks said
  3. Try npm install again
commented

I had the same issue. The sha3 package was included in another dependency I have added to my package.json.
I cannot really explain why but the error disappeared after running

npm i sha3 --save
npm i

Hope that helps

this worked for me! thanks

Downgrading from Node 12 to Node 10 fixed this for me 👍

I am working on ubuntu 18.04. I wanted to install the latest version of truffle, so uninstall it but now I am trying:
$ sudo npm install -g truffle
loadDep:original-require ▀ ╢██████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine mocha@8.1.2: wanted: {"node":">= 10.12.0"} (current: {"node":"8.10.0loadDep:yargs-unparser → ▀ ╢█████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine find-up@5.0.0: wanted: {"node":">=10"} (current: {"node":"8.10.0","nloadDep:yargs-unparser → ▀ ╢█████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine escape-string-regexp@4.0.0: wanted: {"node":">=10"} (current: {"nodeloadDep:yargs-unparser → ▀ ╢█████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine log-symbols@4.0.0: wanted: {"node":">=10"} (current: {"node":"8.10.0loadDep:fsevents → reques ▀ ╢█████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine fsevents@2.1.3: wanted: {"node":"^8.16.0 || ^10.6.0 || >=11.0.0"} (cloadDep:path-exists → req ▌ ╢██████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine locate-path@6.0.0: wanted: {"node":">=10"} (current: {"node":"8.10.0loadDep:p-locate → 304 ▐ ╢██████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine p-locate@5.0.0: wanted: {"node":">=10"} (current: {"node":"8.10.0","loadDep:p-limit → request ▀ ╢██████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine p-limit@3.0.2: wanted: {"node":">=10"} (current: {"node":"8.10.0","nloadDep:chalk → get ▀ ╢██████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
WARN engine chalk@4.1.0: wanted: {"node":">=10"} (current: {"node":"8.10.0","npmnpm ERR! Linux 4.15.0-115-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "truffle"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! code EMISSINGARG

npm ERR! typeerror Error: Missing required argument #1
npm ERR! typeerror at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3)
npm ERR! typeerror at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22)
npm ERR! typeerror at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12)
npm ERR! typeerror at /usr/share/npm/lib/install/deps.js:457:7
npm ERR! typeerror at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror at /usr/share/npm/lib/fetch-package-metadata.js:37:12
npm ERR! typeerror at addRequestedAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:82:5)
npm ERR! typeerror at returnAndAddMetadata (/usr/share/npm/lib/fetch-package-metadata.js:117:7)
npm ERR! typeerror at pickVersionFromRegistryDocument (/usr/share/npm/lib/fetch-package-metadata.js:134:20)
npm ERR! typeerror at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror http://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR! /home/zulfi/npm-debug.log
@lc2530hz:~$
Somebody please guide me.
Zulfi. (zulfi6000@yahoo.com)

For me, it helped:

  • to downgrade npm to version 10
  • in the file .nvm/versions/node/v10.19.0/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/common.py add
 if sys.version_info.major == 3 and sys.version_info.minor >= 10:
    from collections.abc import MutableSet
    collections.MutableSet = collections.abc.MutableSet
else:
    from collections import MutableSet