shnhrrsn / homebridge-openzwave

OpenZWave platform for Homebridge.
MIT License
18 stars 4 forks source link

Issue with Node version 16 #25

Open RicardoLorenzo opened 2 years ago

RicardoLorenzo commented 2 years ago

The issue is this:

$ sudo npm install homebridge-openzwave
...
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from /tmp/.node-gyp/16.13.0/include/node/v8.h:30,
npm ERR!                  from ../src/openzwave.hpp:27,
npm ERR!                  from ../src/callbacks.cc:18:
npm ERR! /tmp/.node-gyp/16.13.0/include/node/v8-internal.h: In function ‘void v8::internal::PerformCastCheck(T*)’:
npm ERR! /tmp/.node-gyp/16.13.0/include/node/v8-internal.h:492:38: error: ‘remove_cv_t’ is not a member of ‘std’; did you mean ‘remove_cv’?
npm ERR!   492 |             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
npm ERR!       |                                      ^~~~~~~~~~~
npm ERR!       |                                      remove_cv
npm ERR! /tmp/.node-gyp/16.13.0/include/node/v8-internal.h:492:38: error: ‘remove_cv_t’ is not a member of ‘std’; did you mean ‘remove_cv’?
npm ERR!   492 |             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
npm ERR!       |                                      ^~~~~~~~~~~
npm ERR!       |                                      remove_cv
npm ERR! /tmp/.node-gyp/16.13.0/include/node/v8-internal.h:492:50: error: template argument 2 is invalid
npm ERR!   492 |             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
npm ERR!       |                                                  ^
npm ERR! /tmp/.node-gyp/16.13.0/include/node/v8-internal.h:492:63: error: ‘::Perform’ has not been declared
npm ERR!   492 |             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
npm ERR!       |                                                               ^~~~~~~
npm ERR! make: *** [openzwave_shared.target.mk:148: Release/obj.target/openzwave_shared/src/callbacks.o] Error 1
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Linux 5.10.63-v7+
npm ERR! gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /home/ricardo/node_modules/openzwave-shared
npm ERR! gyp ERR! node -v v16.13.0
npm ERR! gyp ERR! node-gyp -v v8.2.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-11-17T11_03_22_349Z-debug.log

The workaround is this:

$ sudo CXXFLAGS="--std=c++14" npm i -g homebridge-openzwave

added 5 packages, and audited 6 packages in 4m

found 0 vulnerabilities
blankenshipz commented 2 years ago

I just ran into this; thanks for posting the workaround!

Edit: I'm still having an issue though the build seems to hang on node-gyp rebuild

XueningXu commented 2 years ago

@RicardoLorenzo Thanks so much for the workaround! You just saved my day ~~ :relieved: