Skip to content

[Bug] Unable to perform npm i when trying to contribute #1696

@anirudh-modi

Description

@anirudh-modi

Hi @profnandaa @chriso I wanted to contribute to repo.. so I forked and cloned the repo, however, when I am doing an npm i... I am getting error while installing weak module

 [email protected] install /Users/anirudhmodi/Documents/oss/validator.js/node_modules/weak
> node-gyp rebuild

  CXX(target) Release/obj.target/weakref/src/weakref.o
../src/weakref.cc:147:25: error: too few arguments to function call, expected 4, have 3; did you mean 'Nan::Call'?
  globalCallbackDirect->Call(Nan::GetCurrentContext()->Global(), 1, argv);
                        ^~~~
                        Nan::Call
../../nan/nan_maybe_43_inl.h:345:30: note: 'Nan::Call' declared here
inline MaybeLocal<v8::Value> Call(
                             ^
../src/weakref.cc:168:75: error: too few arguments to function call, single argument 'context' was not specified
  Local<Object> proxy = Nan::New<ObjectTemplate>(proxyClass)->NewInstance();
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/Users/anirudhmodi/Library/Caches/node-gyp/12.18.2/include/node/v8.h:6423:3: note: 'NewInstance' declared here
  V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(Local<Context> context);
  ^
/Users/anirudhmodi/Library/Caches/node-gyp/12.18.2/include/node/v8config.h:368:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
../src/weakref.cc:223:55: error: no member named 'IsNearDeath' in 'Nan::Persistent<v8::Object, v8::NonCopyablePersistentTraits<v8::Object> >'
  Local<Boolean> rtn = Nan::New<Boolean>(cont->target.IsNearDeath());
                                         ~~~~~~~~~~~~ ^
3 errors generated.

On further investigation I found, the error is coming when we are installing rollup, and the version which is used in the repo, is quite old, where they are using weak module, and there is already an issue present in the node-weak which suggests that we should use weak-napi, which is already there in the latest rollup version.
Link to issue: TooTallNate/node-weak#99

My environment details

Node: v12.18.2
Npm: 6.14.2

Now, this could be perhaps solved if we change the version of rollup, but that will be a breaking change with huge impact.

If you have a better solution, let me know about the same.. so that I can contribute..

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions