Build fails on Node 14/Win10: "no overloaded function takes 2 arguments"
When trying to install v1.2.3 with Node 14.1.10 (the latest) and npm 6.14.5 I am getting a warning (first line) and failure (second):
my\project\path\node_modules\sha3\src\addon.cpp(49): warning C4316: 'SHA3Hash': object allocated on the heap may not be aligned 32 [my\project\path\node_modules\sha3\build\sha3.vcxproj] my\project\path\node_modules\sha3\src\addon.cpp(83): error C2661: 'v8::Object::Set': no overloaded function takes 2 arguments [my\project\path\node_modules\sha3\build\sha3.vcxproj] gyp ERR! build error gyp ERR! stack Error:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exefailed with exit code: 1 gyp ERR! stack at ChildProcess.onExit my\global\node\install\node_modules\node-gyp\lib\build.js:194:23) gyp ERR! stack at ChildProcess.emit (events.js:315:20) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12) gyp ERR! System Windows_NT 10.0.18363 gyp ERR! command "[...]node.exe" "npm\install\dir\node_modules\node-gyp\bin\node-gyp.js" "rebuild" gyp ERR! cwd my\project\path\node_modules\sha3 gyp ERR! node -v v14.1.0 gyp ERR! node-gyp -v v5.1.0 gyp ERR! not ok npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] install:node-gyp rebuildnpm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] install script.
It is possible this is related to #32.
Hi @wbt, thanks for the report!
This is an extremely common issue with the 1.x release line. Because it depends on node-gyp and the C compiler and Python interpreter at the OS-level, any time there is a minor version release of either Node.js, node-gyp, that C compiler, the Python interpreter, or even the OS, there's a significant chance that this package's 1.x release (and any other package that uses node-gyp) will break. It's just an inherently fragile system with lots of moving parts that frequently drift out of sync with one another and require code changes to accommodate.
Because of this, I strongly recommend all projects that depend on this package to upgrade to the 2.x release line, which does not suffer from these issues and is actively supported and maintained. The 1.x release line is not actively maintained and depends exclusively on community contributions to keep alive.
If your project depends on another package that depends on a 1.x release of this package, reach out to that package's team to request an upgrade to this package's 2.x release, or for performance-critical use cases consider migration to js-sha3, which is another pure JavaScript implementation optimized for performance but which would require some code changes to migrate.