Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Don't force Node to be on the PATH #20

Closed
andersekdahl opened this issue Dec 6, 2015 · 2 comments
Closed

Don't force Node to be on the PATH #20

andersekdahl opened this issue Dec 6, 2015 · 2 comments

Comments

@andersekdahl
Copy link

From what I can read, the code currently assumes that Node is on the PATH. I think it's a good idea not to bundle a specific version of Node with this package, but it would be great if it was possible to specify where the Node executable is. Would make it easier to deploy multiple sites using this to the same server where the different sites use different Node versions.

@SteveSandersonMS
Copy link
Member

Good idea. This config option could be added to the services.AddNodeServices(config) API, with the default being to continue assuming Node is on the system path.

Pull requests are welcome :)

thunder7553 added a commit to thunder7553/JavaScriptServices that referenced this issue Jul 13, 2016
…ons (and OutOfProcessNodeInstance, SocketNodeInstance and HttpNodeInstance) to configure environment of the node.exe process to be started, and the path to the node executable itself. Fixes aspnet#20
@SteveSandersonMS
Copy link
Member

SteveSandersonMS commented Jul 18, 2016

For anyone wondering how to override the path where the node executable is found, you can do it like this:

public class MyHttpNodeInstance : HttpNodeInstance
{
    protected override ProcessStartInfo PrepareNodeProcessStartInfo(string entryPointFilename, string projectPath, string commandLineArguments)
    {
        var startInfo = base.PrepareNodeProcessStartInfo(entryPointFilename, projectPath, commandLineArguments);

        // Here you can modify 'startInfo' to specify where the Node executable should be found

        return startInfo;
    }
}

... and then set MyHttpNodeInstance as the active Node instance type, as per the docs at https://github.com/aspnet/JavaScriptServices/tree/dev/src/Microsoft.AspNetCore.NodeServices#custom-hosting-models.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants