How to Solve Node GYP Rebuild Error

Node gyp rebuild error handling

Error message:

node-gyp rebuild

  CXX(target) Release/obj.target/contextify/src/contextify.o
../src/contextify.cc:50:53: error: too few arguments to function call, single argument 'context' was not specified
        target->Set(className, ljsTmpl->GetFunction());
                               ~~~~~~~~~~~~~~~~~~~~ ^
/Users/xxx/Library/Caches/node-gyp/14.15.4/include/node/v8.h:6482:46: note: 'GetFunction' declared here
  V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
                                             ^
../src/contextify.cc:60:74: error: too few arguments to function call, single argument 'context' was not specified
        ContextifyContext* ctx = new ContextifyContext(info[0]->ToObject());
                                                       ~~~~~~~~~~~~~~~~~ ^
/Users/xxx/Library/Caches/node-gyp/14.15.4/include/node/v8.h:2822:44: note: 'ToObject' declared here
  V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
                                           ^
../src/contextify.cc:75:48: error: too few arguments to function call, single argument 'context' was not specified
        Local<String> code = info[0]->ToString();
                             ~~~~~~~~~~~~~~~~~ ^
/Users/xxx/Library/Caches/node-gyp/14.15.4/include/node/v8.h:2810:44: note: 'ToString' declared here
  V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
                                           ^
../src/contextify.cc:81:51: error: too few arguments to function call, single argument 'context' was not specified
            ScriptOrigin origin(info[1]->ToString());
                                ~~~~~~~~~~~~~~~~~ ^
/Users/xxx/Library/Caches/node-gyp/14.15.4/include/node/v8.h:2810:44: note: 'ToString' declared here
  V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
                                           ^
../src/contextify.cc:124:45: error: too few arguments to function call, single argument 'context' was not specified
        constructor.Reset(tmpl->GetFunction());

Solution: switch the node version to node 8.17.0 to solve the above error reports

Mac install to multi version node

1. Download and install
NPM install -g n
2. Download the specified version (followed by the version number)
sudo n 14.15.0
3. Display which versions have been installed
n LS
4. Switch the version used (followed by the version number)
sudo n
view the installed version and switch the version used up and down

Read More: