abbr / deasync

Turns async function into sync via JavaScript wrapper of Node event loop
MIT License
972 stars 73 forks source link

Can't build because `node-gyp` missing #155

Open nicholaschiang opened 3 years ago

nicholaschiang commented 3 years ago

When installing this package (deasync@0.1.21) 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.

leaumar commented 2 years ago

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)

prgTW commented 2 years ago

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.

trusktr commented 1 year ago

See this for a solution and workaround: