Skip to content

Deprecated warning with nan v2.7.0 and Node.js 9.0.0 #707

Closed

Description

@fivdi

When a native module using nan v2.7.0 is installed with Node.js 9.0.0 there is a deprecated warning. For example, here's the warning shown when installing the epoll module:

pi@raspberrypi:~/epoll $ npm i epoll

> epoll@1.0.0 install /home/pi/epoll/node_modules/epoll
> node-gyp rebuild

make: Entering directory '/home/pi/epoll/node_modules/epoll/build'
  CXX(target) Release/obj.target/epoll/src/epoll.o
In file included from ../../nan/nan.h:192:0,
                 from ../src/epoll.cc:15:
../../nan/nan_maybe_43_inl.h: In function ‘Nan::Maybe<bool> Nan::ForceSet(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)’:
../../nan/nan_maybe_43_inl.h:112:73: warning: ‘v8::Maybe<bool> v8::Object::ForceSet(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)’ is deprecated: Use CreateDataProperty / DefineOwnProperty [-Wdeprecated-declarations]
   return obj->ForceSet(isolate->GetCurrentContext(), key, value, attribs);
                                                                         ^
In file included from /home/pi/.node-gyp/9.0.0/include/node/v8.h:26:0,
                 from ../src/epoll.cc:11:
/home/pi/.node-gyp/9.0.0/include/node/v8.h:3115:29: note: declared here
                 Maybe<bool> ForceSet(Local<Context> context, Local<Value> key,
                             ^
/home/pi/.node-gyp/9.0.0/include/node/v8config.h:318:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
  SOLINK_MODULE(target) Release/obj.target/epoll.node
  COPY Release/epoll.node
make: Leaving directory '/home/pi/epoll/node_modules/epoll/build'
npm WARN saveError ENOENT: no such file or directory, open '/home/pi/epoll/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/home/pi/epoll/package.json'
npm WARN epoll No description
npm WARN epoll No repository field.
npm WARN epoll No README data
npm WARN epoll No license field.

+ epoll@1.0.0
added 3 packages in 10.643s
pi@raspberrypi:~/epoll $ 

Activity

  1. kkoopa commented on Oct 31, 2017

    @kkoopa
    Collaborator

    That is unfortunate. It was only a question of time. ForceSet has been on its way out in V8 for a long time, but if I remember correctly there is no proper alternative, so the fix is not straightforward, if at all possible. Neither CreateDataProperty not DefineOwnProperty offer the same semantics.
    Related: #504

  2. fivdi commented on Nov 4, 2017

    @fivdi
    Author

    If I understand PR #708 correctly, the plan is leave Nan::ForceSet as it is, mark it as deprecated and introduce Nan::DefineOwnProperty.

    V8 already has v8::Object::ForceSet marked as deprecated. This results in the deprecation warning shown in the above post irrespective of whether Nan::ForceSet is used by an addon or not.

    So if I want to suppress the V8 deprecation warning for v8::Object::ForceSet I'll have to suppress it in my addon because NAN will not be suppressing it, is this correct?

  3. bnoordhuis commented on Nov 4, 2017

    @bnoordhuis
    Member

    @fivdi Yes, correct.

  4. kkoopa commented on Nov 4, 2017

    @kkoopa
    Collaborator
  5. added a commit that references this issue on Nov 7, 2017
  6. kkoopa commented on Nov 10, 2017

    @kkoopa
    Collaborator

    Fixed in master. New release coming soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions