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.

Improve documentation about addons #619

@ibc

Description

@ibc

The README says almost nothing about how to deal with native modules:

Native addons (.node files) use is supported, but packaging .node files inside the executable is not resolved yet. You have to deploy native addons used by your project to the same directory as the executable.

When a package, that contains a native module, is being installed, the native module is compiled against current system-wide Node.js version. Then, when you compile your project with pkg, pay attention to --target option. You should specify the same Node.js version as your system-wide Node.js to make compiled executable compatible with .node files.

Such a text does not explain how to run the generated executable when it's moved out of the project folder:

$ pkg -t macos server.js
[email protected]
Warning Cannot include addon %1 into executable.
The addon must be distributed with executable as %2.
/private/tmp/kk/node_modules/zeromq/build/Release/zmq.node
path-to-executable/zmq.node

Honestly no idea how to understand this warning. What is %1? What is %2?
So, assuming I have the zmq.node binary somewhere in my filesystem, how to invoke my generated server executable? which command line options?

$ ./server
pkg/prelude/bootstrap.js:1178
throw error;
^

Error: Cannot find module '../build/Release/zmq.node'

  1. If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call.

The compilation warning (above) does not help much IMHO.

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