You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
napi_throw_error function syntax in Node v8.2.1 and below is different from N-API V1 docs #778
In Node v8.2.1 N-API docs syntax for napi_throw_error is: NODE_EXTERN napi_status napi_throw_error(napi_env env, const char* msg);
Whereas in the latest Node v14 docs syntax is: NAPI_EXTERN napi_status napi_throw_error(napi_env env, const char* code, const char* msg);
Node v14 docs mention that this method was introduced in N-API version 1 in Node v8.0.0.
code argument is missing in the Node v8.2.1.
When I compile my native add-on compiled using NAPI in Node v8.17.0 it fails to work in Node v8.2.1. And due to syntax differences, the module fails to compile on 8.2.1.
Hi @kanikashah90,
this issue is correlated to this other one #760, now we are updating the documentation in the core through this PR nodejs/node#34344.
The first version that matches version 1 is 8.6.0. N-API was introduced in version v.8.0.0 as experimental and version 1 continued to evolve until v8.7.0 and therefore the shape of the API in earlier versions is not truly version 1 (in hindsight we should have called it version 0). We recommend version 3 or later.
Activity
NickNaso commentedon Jul 28, 2020
Hi @kanikashah90,
this issue is correlated to this other one #760, now we are updating the documentation in the core through this PR nodejs/node#34344.
The first version that matches version 1 is 8.6.0. N-API was introduced in version v.8.0.0 as experimental and version 1 continued to evolve until v8.7.0 and therefore the shape of the API in earlier versions is not truly version 1 (in hindsight we should have called it version 0). We recommend version 3 or later.
Hope that this help you.
gabrielschulhof commentedon Aug 3, 2020
The documentation fix to address this issue has landed in core at nodejs/node#34344.