msgpack / msgpack-node

MessagePack implementation for Node.js
Other
311 stars 71 forks source link

Failed to build with node v16.10.0 #58

Open boompig opened 2 years ago

boompig commented 2 years ago

$ yarn add msgpack

yarn add v1.22.15 [1/4] 🔍 Resolving packages... [2/4] 🚚 Fetching packages... [3/4] 🔗 Linking dependencies... [4/4] 🔨 Building fresh packages... [1/2] ⠠ argon2 error /Users/xxx/prog/passzero/node_modules/msgpack: Command failed. Exit code: 1 Command: node-gyp rebuild Arguments: Directory: /Users/xxxxx/prog/passzero/node_modules/msgpack Output: gyp info it worked if it ends with ok gyp info using node-gyp@7.1.2 gyp info using node@16.10.0 | darwin | x64 gyp info find Python using Python version 3.9.7 found at "/Users/xxxx/prog/passzero/env/bin/python3" (node:41989) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only. (Use node --trace-deprecation ... to show where the warning was created) gyp info spawn /Users/xxxxxx/prog/passzero/env/bin/python3 gyp info spawn args [ gyp info spawn args '/usr/local/lib/node_modules/npm/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 '/Users/xxxxx/prog/passzero/node_modules/msgpack/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/Users/xxxxx/Library/Caches/node-gyp/16.10.0/include/node/common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=/Users/xxxxx/Library/Caches/node-gyp/16.10.0', gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp', gyp info spawn args '-Dnode_lib_file=/Users/xxxxxx/Library/Caches/node-gyp/16.10.0/<(target_arch)/node.lib', gyp info spawn args '-Dmodule_root_dir=/Users/xxxxxxx/prog/passzero/node_modules/msgpack', gyp info spawn args '-Dnode_engine=v8', 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 info spawn args ] gyp info spawn make gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ] CC(target) Release/obj.target/libmsgpack/deps/msgpack/objectc.o CC(target) Release/obj.target/libmsgpack/deps/msgpack/unpack.o CC(target) Release/obj.target/libmsgpack/deps/msgpack/vrefbuffer.o CC(target) Release/obj.target/libmsgpack/deps/msgpack/zone.o CC(target) Release/obj.target/libmsgpack/deps/msgpack/version.o LIBTOOL-STATIC Release/msgpack.a CXX(target) Release/obj.target/msgpackBinding/src/msgpack.o In file included from ../src/msgpack.cc:1: In file included from /Users/xxxxxxx/Library/Caches/node-gyp/16.10.0/include/node/v8.h:30: /Users/xxxxxxx/Library/Caches/node-gyp/16.10.0/include/node/v8-internal.h:489:38: error: no template named 'remove_cv_t' in namespace 'std'; did you mean 'remove_cv'? !std::is_same<Data, std::remove_cv_t>::value>::Perform(data);


                                     remove_cv
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:776:50: note: 'remove_cv' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_cv
                                                 ^
1 error generated.
make: *** [Release/obj.target/msgpackBinding/src/msgpack.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Darwin 20.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/xxxxxxx/prog/passzero/node_modules/msgpack
gyp ERR! node -v v16.10.0
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok
boompig commented 2 years ago

It worked when I downgraded to node version 15, which points to node 16 not yet being supported by this package. It would be nice to get node16 support if possible.

worotyns commented 2 years ago

You can use @msgpack/msgpack

Before check "compatibility" of your code.

var {encode, decode} = require("@msgpack/msgpack")
var { deepStrictEqual } = require("assert");
var msgpack = require('msgpack');

const object = {
  nil: null,
  integer: 1,
  float: Math.PI,
  string: "Hello, world!",
  array: [10, 20, 30],
  map: { foo: "bar" },
};

const encodedByMsgPack = msgpack.pack(object);
const encodedByNewLib = encode(object);

deepStrictEqual(decode(encodedByNewLib), object);
deepStrictEqual(msgpack.unpack(encodedByMsgPack), object);
deepStrictEqual(msgpack.unpack(encodedByMsgPack), decode(encodedByNewLib));

In my case it's compatible - so it's ok to change ;-)