LiskArchive/lisk-db

Including lisk-db as a dependency when there's no prebuild should build from source

Closed this issue · 0 comments

Expected behavior

if I'm building lisk core, or any other package that uses lisk-db as a dependency, and there's no prebuild for my platform, npm should attempt to build lisk-db from source

Actual behavior

No attempt is made

~/lisk-core # npm ci
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code 1
npm ERR! path /root/lisk-core/node_modules/@liskhq/lisk-db
npm ERR! command failed
npm ERR! command sh -c -- node-pre-gyp install
npm ERR! response status 404 Not Found on https://js.lisk.com/lisk-db/0.3.0-debug.20-52ffbeac2c1b0b188e8df995a1dc6a1634426a27/index-v0.3.0-debug.20-52ffbeac2c1b0b188e8df995a1dc6a1634426a27-node-v93-linux-x64-musl.tar.gz
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@1.0.10
npm ERR! node-pre-gyp info using node@16.19.0 | linux | x64
npm ERR! node-pre-gyp info check checked for "/root/lisk-core/node_modules/@liskhq/lisk-db/bin-package/index.node" (not found)
npm ERR! node-pre-gyp http GET https://js.lisk.com/lisk-db/0.3.0-debug.20-52ffbeac2c1b0b188e8df995a1dc6a1634426a27/index-v0.3.0-debug.20-52ffbeac2c1b0b188e8df995a1dc6a1634426a27-node-v93-linux-x64-musl.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://js.lisk.com/lisk-db/0.3.0-debug.20-52ffbeac2c1b0b188e8df995a1dc6a1634426a27/index-v0.3.0-debug.20-52ffbeac2c1b0b188e8df995a1dc6a1634426a27-node-v93-linux-x64-musl.tar.gz
npm ERR! node-pre-gyp ERR! install error
npm ERR! node-pre-gyp ERR! stack Error: response status 404 Not Found on https://js.lisk.com/lisk-db/0.3.0-debug.20-52ffbeac2c1b0b188e8df995a1dc6a1634426a27/index-v0.3.0-debug.20-52ffbeac2c1b0b188e8df995a1dc6a1634426a27-node-v93-linux-x64-musl.tar.gz
npm ERR! node-pre-gyp ERR! stack     at /root/lisk-core/node_modules/@mapbox/node-pre-gyp/lib/install.js:67:15
npm ERR! node-pre-gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:96:5)
npm ERR! node-pre-gyp ERR! System Linux 5.15.90-gentoo
npm ERR! node-pre-gyp ERR! command "/usr/local/bin/node" "/root/lisk-core/node_modules/.bin/node-pre-gyp" "install"
npm ERR! node-pre-gyp ERR! cwd /root/lisk-core/node_modules/@liskhq/lisk-db
npm ERR! node-pre-gyp ERR! node -v v16.19.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.10
npm ERR! node-pre-gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2023-02-02T14_42_11_559Z-debug-0.log

Steps to reproduce

The easiest way is to try this in docker.

docker pull node:16-alpine
docker run -it node:16-alpine /bin/sh
cd ~
apk update
apk add automake autoconf libtool linux-headers python3 rust cargo clang clang-libs clang-dev
git clone https://github.com/LiskHQ/lisk-core.git
cd lisk-core
npm ci

Which version(s) does this affect? (Environment, OS, etc...)

Any where there's no prebuild. Not that we make any promises about unsupported platforms, but npm should at least attempt to build before failing

I think it's just this guy that needs to be changed:

diff --git a/publish.js b/publish.js
index ddceedd..274c566 100644
--- a/publish.js
+++ b/publish.js
@@ -44,7 +44,7 @@
  if (canarySHA) {
     originalPackageJSON.version = `${originalPackageJSON.version}-${canarySHA}`;
  }
- originalPackageJSON.scripts.install = "node-pre-gyp install";
+ originalPackageJSON.scripts.install = "node-pre-gyp install --fallback-to-build";
  fs.writeFileSync("./package.json", JSON.stringify(originalPackageJSON, null, 2));

  //Use a fully qualified path to pre-gyp binary for Windows support