Search code examples
npmphantomjsddevphantomjs-node

DDEV how handle Node package that does not support M1 Mac architecture?


I'm trying to understand how to proceed with a repo I've started working on that uses PhantomJS, a node package that was last published five years ago and doesn't seem to support M1 Macs.

Other than running an AMD64 Docker container on my Mac, is there any option beyond changing the codebase? Changing the codebase would pose problems for colleagues not on M1 machines.

The error messages:

Now using node v14.17.6 (npm v6.14.15)
Build theme
npm WARN deprecated [email protected]: this package is now deprecated

> [email protected] install /var/www/html/www/themes/custom/rutherford/node_modules/phantomjs-prebuilt
> node install.js

PhantomJS not found on PATH
Unexpected platform or architecture: linux/arm64
It seems there is no binary available for your platform/architecture
Try to install PhantomJS globally


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.


PhantomJS: https://www.npmjs.com/package/phantomjs-prebuilt

Thank you.


Solution

  • You'll need to switch to a supported package that supports arm64. Or you'll need to go back to your amd64 mac.

    There are probably ways to use --platform linux/amd64 with your web container, but my expectation is you'll be very unhappy and get really bad results.

    There are a number of deprecated/abandoned npm packages that don't have arm64 support. The most common one people stumble on is node-sass