Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
H1X4Dev opened this issue Jan 21, 2020 · 2 comments
Closed

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

H1X4Dev opened this issue Jan 21, 2020 · 2 comments

Comments

@H1X4Dev
Copy link

H1X4Dev commented Jan 21, 2020

Hello,

When installing the latest version (npm install [email protected]) 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.

@richardlau
Copy link
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

@H1X4Dev
Copy link
Author

H1X4Dev commented Jan 21, 2020

Oh! Makes sense.

Thank you for the clarification. Will be closing this.

@H1X4Dev H1X4Dev closed this as completed Jan 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants