镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Napi::Env::RunScript is missing. #655

Closed

Description

@H1X4Dev

Hello,

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 docs do say that it exists: https://github.com/nodejs/node-addon-api/blob/master/doc/env.md#runscript
The Napi header says it exists: https://github.com/nodejs/node-addon-api/blob/master/napi.h#L188

HOWEVER

The downloaded version via npm does not seem to reflect the same version as it is here on github.
image

From github:
image

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.

Activity

  1. richardlau commented on Jan 21, 2020

    @richardlau
    Member

    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

  2. H1X4Dev commented on Jan 21, 2020

    @H1X4Dev
    Author

    Oh! Makes sense.

    Thank you for the clarification. Will be closing this.

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