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
When installing the latest version (npm install node-addon-api@2.0.0) seems like the RunScript function is missing entirely.
Error reported from compiler:
error C2039: 'RunScript': is not a member of 'Napi::Env'
Sample code:
Napi::Value execute_code(const Napi::CallbackInfo& info)
{
Napi::Env env = info.Env();
// If there is no info passed, do not execute the code.
if (info.Length() < 1)
return Napi::Boolean::New(env, false);
try
{
Napi::Value result = env.RunScript(info[0].As<Napi::String>());
}
catch(std::exception&)
{
// will be denied by further return anyway.
}
return Napi::Boolean::New(info.Env(), false);
}
The downloaded version via npm does not seem to reflect the same version as it is here on github.
From github:
How come the npm version is mismatching so much even tho it says that they are the same "version"?
Those who are affected by this issue, you are free to install the actual latest version using npm install @h1x4dev/node-addon-api (include in gyp changes to require('@h1x4dev/node-addon-api').include) until the issue is resolved here.
The change (#616) landed on master in December. The most recent release (2.0.0) was at the end of November so there is no current release that contains RunScript. Discussion about the next release is in #646.
Activity
richardlau commentedon Jan 21, 2020
The change (#616) landed on master in December. The most recent release (2.0.0) was at the end of November so there is no current release that contains RunScript. Discussion about the next release is in #646.
For version 2.0.0:
https://github.com/nodejs/node-addon-api/blob/2.0.0/doc/env.md
https://github.com/nodejs/node-addon-api/blob/2.0.0/napi.h
H1X4Dev commentedon Jan 21, 2020
Oh! Makes sense.
Thank you for the clarification. Will be closing this.