Can't build because `node-gyp` missing
When installing this package ([email protected]) using Yarn v2 on Mac OS X with Node.js 16.13.0 I get this error:
This file contains the result of Yarn building a package (deasync@npm:0.1.21) Script name: install
Usage Error: Couldn't find a script name "node-gyp" in the top-level (used by deasync@npm:0.1.21). This typically happens because some package depends on "node-gyp" to build itself, but didn't list it in their dependencies. To fix that, please run "yarn add node-gyp" into your top-level workspace. You also can open an issue on the repository of the specified package to suggest them to use an optional peer dependency.
$ yarn run [--inspect] [--inspect-brk] <scriptName> ...Build failed
To fix this, you should probably list node-gyp in your peerDependencies.
Also breaks the build of deasync (for parcel-bundler) on gitlab CI in a nodejs 17 docker image. Please follow up on this issue.
I thought adding this to yarnrc would be a viable workaround, since the error explains it just boils down to node-gyp missing, but nothing changes:
packageExtensions:
deasync@*:
peerDependencies:
node-gyp: latest
(I also tried with dependencies instead of peerDependencies)
FWIW I've managed to install my dependencies on alpine v3.16 and node v18 after running the following:
sudo apk add --no-cache python3 g++
I doubt that installing build essentials is, or should be, necessary, but I'm totally not a frontend dev so just wanted to share my observation.
See this for a solution and workaround:
- https://github.com/abbr/deasync/issues/181