I was getting the following error when running pkg on my project:
pkg/prelude/bootstrap.js:1185
throw error;
^
Error: No native build was found for platform=linux arch=x64 runtime=node abi=64 uv=1 libc=musl
at Function.load.path (/snapshot/app/node_modules/node-gyp-build/index.js:56:9)
at load (/snapshot/app/node_modules/node-gyp-build/index.js:20:30)
at Object.<anonymous> (/snapshot/app/node_modules/sodium-native/index.js:1:101)
at Module._compile (pkg/prelude/bootstrap.js:1261:22)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:710:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Module.require (internal/modules/cjs/loader.js:635:17)
at Module.require (pkg/prelude/bootstrap.js:1166:31)
This error seems to be the same as this issue vercel/pkg#705. I was able to narrow the error down to the following minimal project whose files are here.
First git clone or download the zip of this gist. Then you can either reproduce the error on your machine (I am using and reproducing the error on macOS mojave 10.14.6) or you can reproduce the error on docker node10-alpine image with the following image file. I will include steps for both.
- If you haven't already, git clone or download the zip of this gist and enter the gist directory
- Run yarn install
- Run yarn build
- Open the application from finder, here the following error should appear in the terminal:
pkg/prelude/bootstrap.js:1185
throw error;
^
Error: No native build was found for platform=darwin arch=x64 runtime=node abi=64 uv=1 libc=glibc
at Function.load.path (/snapshot/test/node_modules/node-gyp-build/index.js:56:9)
at load (/snapshot/test/node_modules/node-gyp-build/index.js:20:30)
at Object.<anonymous> (/snapshot/test/node_modules/sodium-native/index.js:1:101)
at Module._compile (pkg/prelude/bootstrap.js:1261:22)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:710:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Module.require (internal/modules/cjs/loader.js:635:17)
at Module.require (pkg/prelude/bootstrap.js:1166:31)
logout
Saving session...completed.
[Process completed]
- enter the directory
- run yarn docker:build (it could take a while)
- run yarn docker:run
- the following error output should appear:
yarn run v1.17.3
$ docker container run -t failed-pkg
pkg/prelude/bootstrap.js:1185
throw error;
^
Error: No native build was found for platform=linux arch=x64 runtime=node abi=64 uv=1 libc=musl
at Function.load.path (/snapshot/app/node_modules/node-gyp-build/index.js:56:9)
at load (/snapshot/app/node_modules/node-gyp-build/index.js:20:30)
at Object.<anonymous> (/snapshot/app/node_modules/sodium-native/index.js:1:101)
at Module._compile (pkg/prelude/bootstrap.js:1261:22)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:710:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Module.require (internal/modules/cjs/loader.js:635:17)
at Module.require (pkg/prelude/bootstrap.js:1166:31)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
This is just to show the file can be run normally
- enter the directory
- yarn install
- yarn start
- should then output Authenticated.
- enter the directory
- yarn docker:build
- yarn docker:sh
- (You should now be in the node10-alpine docker container shell)
- yarn start
- should then output Authenticated.
- type
exit
to exit the node10-alpine image shell