Shopify / node-themekit

Theme asset interaction library and management tools written in Node.js
MIT License
114 stars 25 forks source link

Unable to install if no binary available #99

Open MichaelMackus opened 3 years ago

MichaelMackus commented 3 years ago

Problem

Unable to use themekit on arm64 linux (or any other system where there is no binary available)

Replication steps

Run "npm install -g @shopify/themekit" on arm64 linux.

More Information

It seems like themekit doesn't allow any sort of fallback to build if there is no binary available for the architecture. Most other NPM packages use this approach, so that those on different architectures can still use the software (at the cost of compile time). Alternatively, themekit should at least allow the user to use a system installation of themekit if available, which would help alleviate the issue.

I tried building themekit manually (which worked quite well on arm64) and then symlinking the binary to the bin in the node-themekit directory. However, node-themekit seems to force the installation by deleting the binary & then trying to re-install (which fails since there is no arm64 linux binary).

I think having some sort of fallback would be good, even if the arm64 binary does get added eventually. This way we could also install themekit on something like RISC or other alternative architectures.

Having this fallback could also help getting the build working for ARM-based macbooks.

MichaelMackus commented 3 years ago

Error output:


npm ERR! code 1
npm ERR! path /usr/lib/node_modules/@shopify/themekit
npm ERR! command failed
npm ERR! command sh -c node ./lib/cli.js install
npm ERR! -
npm ERR! /usr/lib/node_modules/@shopify/themekit/lib/install.js:37
npm ERR!     throw new Error(err);
npm ERR!           ^
npm ERR!
npm ERR! Error: Error: Command failed: /usr/lib/node_modules/@shopify/themekit/bin/theme version
npm ERR! /usr/lib/node_modules/@shopify/themekit/bin/theme: /usr/lib/node_modules/@shopify/themekit/bin/theme: cannot execute binary file
npm ERR!
npm ERR!
npm ERR!     at install (/usr/lib/node_modules/@shopify/themekit/lib/install.js:37:11)
npm ERR!     at runMicrotasks (<anonymous>)
npm ERR!     at processTicksAndRejections (node:internal/process/task_queues:96:5)
Sambuxc commented 1 year ago

Has anyone got any further info on this? I'm getting a similar error. This is when I run npm install Node v10.14.0 Slate v0.14.0 Npm v 6.4.1 Mac OS Venture 13.2.1 - Intel Core i7

> node ./lib/cli.js install

\/packages/slate-tools/node_modules/@shopify/themekit/lib/install.js:46
        throw runErr;
        ^

Error: The `/packages/slate-tools/node_modules/@shopify/themekit/bin/theme` binary doesn't seem to work correctly
    at BinWrapper.<anonymous> (/packages/slate-tools/node_modules/bin-wrapper/index.js:156:7)
    at ChildProcess.<anonymous> (/packages/slate-tools/node_modules/bin-check/index.js:26:4)
    at ChildProcess.emit (events.js:182:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @shopify/themekit@0.6.6 postinstall: `node ./lib/cli.js install`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @shopify/themekit@0.6.6 postinstall script.