Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Collection of pkg nodejs binaries that are not supported by pkg

License

NotificationsYou must be signed in to change notification settings

yao-pkg/pkg-binaries

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PRs Welcome

Buy Me A CoffeePayPalPatreon

Collection of NodeJS precompiled binaries to use withpkg. Please submit a pull request if you have others that are not present here.

ALL BINARIES HAVE BEEN MOVED TO RELEASES ASSETS. YOU WILL FIND ALL BINARIESHERE

Usage

Download the binary inside pkg cache folder before compiling your application.

Example witharmv7node v16.16.0linux:

CACHE=~/.pkg-cache/custom#custom cache foldermkdir -p$CACHEexport PKG_CACHE_PATH=$CACHEexport PKG_IGNORE_TAG=true# prevents pkg-fetch to add a tag foldercurl https://github.com/yao-pkg/pkg-binaries/releases/download/node16/built-v16.16.0-linux-armv7 -LO$CACHE/built-v16.16.0-linux-armv7# download the binary, be sure it is prefixewd with built-, otherwise it will not worknpx pkg -t node16-linux-armv7.# compile your application

ATTENTION

Once you have placed the file in.pkg-cache folder check that the output offile command gives you the correct interpreter:

pi@NanoPi-NEO-Plus2:~/.pkg-cache/v2.6$ file fetched-v8.11.3-linux-arm64fetched-v8.11.3-linux-arm64: ELF 64-bit LSB shared object, ARM aarch64, version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-,for GNU/Linux 3.7.0, BuildID[sha1]=02bf3444ecc520c4da40e89cbfbf6831e3a205ea, not stripped

Sometimes when usingwget it could be downloaded asHTML text file and it wouldn't work.

Utils

In utils folder you will find a bash scriptpackage.sh that I have created to package my nodejs application.

Copy the script in your app directory and edit it with your appName and the destination folder of the pkg compiled output.

# EDIT THIS WITH YOUR VALUESAPP="appName"PKG_FOLDER="pkg"

It also automatically scannode_modules folder and adds required.node files that pkg is not able to package.

You will find all your files inside the destination folder and they will be also packaged inside a .zip file with appName and version choosed.

If you want to make things more easy add a script in yourpackage.json file:

"scripts": {"start":"sudo node ./bin/www",//default to start the application"package":"sudo chmod +x package.sh && ./package.sh"}

Than simply runnpm run package to start the script

Compilation guide

Using Docker

This allows to compile nodejs pkg binary forarm32 (armv7l, armv6) andarm64 archs from ax86_64.

Steps

# Clone this repogit clone https://github.com/robertsLando/pkg-binaries.gitcd pkg-binaries# Build the required binarychmod +x build.sh./build.sh# Follow build steps and wait for nodejs to be compiled (WILL TAKE AROUND 24 HOURS!)

Manually

This requires to run commands in a CPU with the required build ARCH

Here is a guide to manually compile a nodejs binary from source.Usually pkg automatically compiles this binary if it doesn't find them in his resources but this process may fail and this is how to do it by your self. In this example I'm compiling nodejs 8 LTS using a device with Linux with architecture arm64 (to check the information about your device run the comanduname -a).

  1. Install required build tools:

    sudo apt-get install build-essential

  2. Than clone node:

    git clone https://github.com/nodejs/node.git

  3. Checkout to the desired version:

    cd nodegit checkout v8.11.3

  4. Create the patch file inside the node dir and paste the content from the patch file you find on pkg-fetch github insidepatch directory (https://raw.githubusercontent.com/zeit/pkg-fetch/master/patches/node.v8.11.3.cpp.patch)

    sudo nano node.v8.11.3.cpp.patch (Ctrl+Maiusc+V - Ctrl+X - Y)

    git apply node.v8.11.3.cpp.patch

    ./configure

    make (this takes many minutes, even hours in some devices)

  5. Finally copy the binary:

    cp node ~/.pkg-cache/v2.6/fetched-v8.11.3-linux-arm64


[8]ページ先頭

©2009-2025 Movatter.jp