Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.
This repository was archived by the owner on Jan 13, 2024. It is now read-only.

Can I use pkg's bundled executable file as node itself? #864

Closed

Description

@RogerKang

Assume I have a bundled file named as bundleFile. It should contains the whole nodejs runtime and other resources including node libraries、glob resources and so on.
And can I use it to run other script files? Like: (the input form is not proper but you know what I mean)
bundleFile other.js
Because bundleFile has the whole nodejs runtime, it should be possible technically. And I swear that I have seem this implementation on other tools.

Activity

  1. cspotcode commented on Mar 16, 2020

    @cspotcode

    Pretty sure you would need your .js code to handle this, for example, by parsing the argv array and executing the right require() statement.

  2. igorklopov commented on Mar 16, 2020

    @igorklopov
    Contributor

    You need to set PKG_EXECPATH env var to PKG_INVOKE_NODEJS when running bundled executable. For example PKG_EXECPATH=PKG_INVOKE_NODEJS ./yourapp -p 42

  3. RogerKang commented on Mar 18, 2020

    @RogerKang
    Author

    PKG_INVOKE_NODEJS

    It works, thanks!

  4. RogerKang commented on Mar 18, 2020

    @RogerKang
    Author

    Pretty sure you would need your .js code to handle this, for example, by parsing the argv array and executing the right require() statement.

    Thanks! It could be an option.

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