backpack icon indicating copy to clipboard operation
backpack copied to clipboard

Not work in node 10

Open kamontat opened this issue 6 years ago • 1 comments

This cause compile error on aligned-buffer


error /Users/kamontat/Desktop/Workspaces/wikidata-api/node_modules/aligned-buffer: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /Users/kamontat/Desktop/Workspaces/wikidata-api/node_modules/aligned-buffer
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp http GET https://nodejs.org/download/release/v10.13.0/node-v10.13.0-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v10.13.0/node-v10.13.0-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v10.13.0/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v10.13.0/SHASUMS256.txt
gyp info spawn /usr/bin/python
gyp info spawn args [ '/Users/kamontat/.nvm/versions/node/v10.13.0/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/kamontat/Desktop/Workspaces/wikidata-api/node_modules/aligned-buffer/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/kamontat/.nvm/versions/node/v10.13.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/kamontat/.node-gyp/10.13.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/kamontat/.node-gyp/10.13.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/kamontat/.nvm/versions/node/v10.13.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/kamontat/.node-gyp/10.13.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/kamontat/Desktop/Workspaces/wikidata-api/node_modules/aligned-buffer',
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 make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CXX(target) Release/obj.target/aligned_buffer/src/aligned-buffer.o
../src/aligned-buffer.cc:16:52: error: no member named 'New' in 'v8::String'
    return ThrowException(Exception::Error(String::New(what)));
                                           ~~~~~~~~^
../src/aligned-buffer.cc:19:31: error: unknown type name 'Arguments'; did you mean 'v8::internal::Arguments'?
Handle<Value> alignment(const Arguments &args) {
                              ^~~~~~~~~
                              v8::internal::Arguments
/Users/kamontat/.node-gyp/10.13.0/include/node/v8.h:144:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
../src/aligned-buffer.cc:20:45: error: too few arguments to function call, expected 2, have 1
    return Number::New(sysconf(_SC_PAGESIZE));
           ~~~~~~~~~~~                      ^
/Users/kamontat/.node-gyp/10.13.0/include/node/v8.h:3035:3: note: 'New' declared here
  static Local<Number> New(Isolate* isolate, double value);
  ^
../src/aligned-buffer.cc:23:28: error: unknown type name 'Arguments'; did you mean 'v8::internal::Arguments'?
Handle<Value> buffer(const Arguments &args) {
                           ^~~~~~~~~
                           v8::internal::Arguments
/Users/kamontat/.node-gyp/10.13.0/include/node/v8.h:144:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
../src/aligned-buffer.cc:24:13: error: member access into incomplete type 'const v8::internal::Arguments'
    if (args.Length() < 2) {
            ^
/Users/kamontat/.node-gyp/10.13.0/include/node/v8.h:144:7: note: forward declaration of 'v8::internal::Arguments'
class Arguments;
      ^
../src/aligned-buffer.cc:28:37: error: type 'const v8::internal::Arguments' does not provide a subscript operator
    size_t alignment = (size_t) args[0]->ToNumber()->Value();
                                ~~~~^~
../src/aligned-buffer.cc:29:37: error: type 'const v8::internal::Arguments' does not provide a subscript operator
    size_t size      = (size_t) args[1]->ToNumber()->Value();
                                ~~~~^~
../src/aligned-buffer.cc:42:5: error: unexpected namespace name 'Buffer': expected expression
    Buffer * Result = Buffer::New((char *) buf, size, free_aligned_buffer, NULL);
    ^
../src/aligned-buffer.cc:42:14: error: use of undeclared identifier 'Result'; did you mean 'result'?
    Buffer * Result = Buffer::New((char *) buf, size, free_aligned_buffer, NULL);
             ^~~~~~
             result
../src/aligned-buffer.cc:32:9: note: 'result' declared here
    int result = posix_memalign(&buf, alignment, size);
        ^
../src/aligned-buffer.cc:42:23: error: no matching function for call to 'New'
    Buffer * Result = Buffer::New((char *) buf, size, free_aligned_buffer, NULL);
                      ^~~~~~~~~~~
/Users/kamontat/.node-gyp/10.13.0/include/node/node_buffer.h:56:40: note: candidate function not viable: requires at most 3 arguments, but 4 were provided
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                       ^
/Users/kamontat/.node-gyp/10.13.0/include/node/node_buffer.h:68:40: note: candidate function not viable: requires 3 arguments, but 4 were provided
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                       ^
/Users/kamontat/.node-gyp/10.13.0/include/node/node_buffer.h:61:40: note: candidate function not viable: requires 5 arguments, but 4 were provided
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                       ^
/Users/kamontat/.node-gyp/10.13.0/include/node/node_buffer.h:53:40: note: candidate function not viable: requires 2 arguments, but 4 were provided
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate, size_t length);
                                       ^
../src/aligned-buffer.cc:44:17: error: calling a protected constructor of class 'v8::HandleScope'
    HandleScope scope;
                ^
/Users/kamontat/.node-gyp/10.13.0/include/node/v8.h:883:13: note: declared protected here
  V8_INLINE HandleScope() {}
            ^
../src/aligned-buffer.cc:46:18: error: no member named 'Close' in 'v8::HandleScope'
    return scope.Close(Result->handle_);
           ~~~~~ ^
../src/aligned-buffer.cc:46:24: error: use of undeclared identifier 'Result'
    return scope.Close(Result->handle_);
                       ^
../src/aligned-buffer.cc:51:5: error: no matching function for call to 'NODE_SET_METHOD'
    NODE_SET_METHOD(target, "alignment", alignment);
    ^~~~~~~~~~~~~~~
/Users/kamontat/.node-gyp/10.13.0/include/node/node.h:392:25: note: expanded from macro 'NODE_SET_METHOD'
#define NODE_SET_METHOD node::NODE_SET_METHOD
                        ^~~~~~~~~~~~~~~~~~~~~
/Users/kamontat/.node-gyp/10.13.0/include/node/node.h:378:13: note: candidate function not viable: no known conversion from 'Handle<v8::Value> (const v8::internal::Arguments &)' (aka 'v8::Local<v8::Value> (const v8::internal::Arguments &)') to 'v8::FunctionCallback' (aka 'void (*)(const FunctionCallbackInfo<v8::Value> &)') for 3rd argument
inline void NODE_SET_METHOD(v8::Local<v8::Object> recv,
            ^
/Users/kamontat/.node-gyp/10.13.0/include/node/node.h:364:13: note: candidate function not viable: no known conversion from 'Handle<v8::Value> (const v8::internal::Arguments &)' (aka 'v8::Local<v8::Value> (const v8::internal::Arguments &)') to 'v8::FunctionCallback' (aka 'void (*)(const FunctionCallbackInfo<v8::Value> &)') for 3rd argument
inline void NODE_SET_METHOD(v8::Local<v8::Template> recv,
            ^
../src/aligned-buffer.cc:52:5: error: no matching function for call to 'NODE_SET_METHOD'
    NODE_SET_METHOD(target, "buffer", buffer);
    ^~~~~~~~~~~~~~~
/Users/kamontat/.node-gyp/10.13.0/include/node/node.h:392:25: note: expanded from macro 'NODE_SET_METHOD'
#define NODE_SET_METHOD node::NODE_SET_METHOD
                        ^~~~~~~~~~~~~~~~~~~~~
/Users/kamontat/.node-gyp/10.13.0/include/node/node.h:378:13: note: candidate function not viable: no known conversion from 'Handle<v8::Value> (const v8::internal::Arguments &)' (aka 'v8::Local<v8::Value> (const v8::internal::Arguments &)') to 'v8::FunctionCallback' (aka 'void (*)(const FunctionCallbackInfo<v8::Value> &)') for 3rd argument
inline void NODE_SET_METHOD(v8::Local<v8::Object> recv,
            ^
/Users/kamontat/.node-gyp/10.13.0/include/node/node.h:364:13: note: candidate function not viable: no known conversion from 'Handle<v8::Value> (const v8::internal::Arguments &)' (aka 'v8::Local<v8::Value> (const v8::internal::Arguments &)') to 'v8::FunctionCallback' (aka 'void (*)(const FunctionCallbackInfo<v8::Value> &)') for 3rd argument
inline void NODE_SET_METHOD(v8::Local<v8::Template> recv,
            ^
15 errors generated.
make: *** [Release/obj.target/aligned_buffer/src/aligned-buffer.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/kamontat/.nvm/versions/node/v10.13.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/Users/kamontat/.nvm/versions/node/v10.13.0/bin/node" "/Users/kamontat/.nvm/versions/node/v10.13.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/kamontat/Desktop/Workspaces/wikidata-api/node_modules/aligned-buffer
gyp ERR! node -v v10.13.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

kamontat avatar Nov 27 '18 13:11 kamontat

Can you use nvm and have the latest for this specific project? The only odd man out is Windows.

Install nvm, add a .nvmrc file next to your package.json, nvm exec npm ... or nvm use before doing other commands within the project.

tracker1 avatar Jul 15 '19 21:07 tracker1