segmentio / analytics-next

Segment Analytics.js 2.0
https://segment.com/docs/connections/sources/catalog/libraries/website/javascript
MIT License
403 stars 136 forks source link

Can not install library without node overrides #1044

Closed broksonic21 closed 2 months ago

broksonic21 commented 7 months ago

See : https://github.com/segmentio/tsub-js/issues/45 which is the cause

Current tsub dependency (https://github.com/segmentio/analytics-next/blob/9b1540fa7851ba4077c8828357fb1125920e1337/packages/browser/package.json#L56) is dependent on stdlib-js/math-base-special-ldexp @ ^0.0.5 which is buggy installing (on Mac's at least) due to node-gyp

See https://github.com/segmentio/analytics-next/issues/818 for more as well

If you could bump that to support 0.2.1 it works fine. We do it via overrides right now, but npm and overrides cause other issues so be good to mainline this.

npm ERR! path /node_modules/@stdlib/number-float64-base-normalize
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.3.1
npm ERR! gyp info using node@18.15.0 | darwin | x64
.........
.........
.........
npm ERR! gyp info spawn args ]
npm ERR! gyp: binding.gyp not found (cwd: /node_modules/@stdlib/number-float64-base-normalize) while trying to load binding.gyp
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/Users/.n/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:325:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Darwin 22.3.0
npm ERR! gyp ERR! command "/Users/.n/bin/node" "/Users/.n/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /node_modules/@stdlib/number-float64-base-normalize
npm ERR! gyp ERR! node -v v18.15.0
npm ERR! gyp ERR! node-gyp -v v9.3.1
npm ERR! gyp ERR! not ok

I also get this with node 20 and node-gyp 10

feimosi commented 6 months ago

@broksonic21 can you please share the exact overrides that worked for you?

pkarl commented 6 months ago

@broksonic21 can you please share the exact overrides that worked for you?

in the linked thread it can be worked around w/out an override by installing npm i @stdlib/number-float64-base-normalize@0.0.8 --save-dev --save-exact

broksonic21 commented 6 months ago

Yep, that's what we are doing - installing 0.0.8 explicitly and avoiding overrides (since npm overrides are super buggy)

npm i @stdlib/number-float64-base-normalize@0.0.8 --save-dev --save-exact

broksonic21 commented 5 months ago

Segment team: any chance to get a fix in on this?

@silesky as this blocks any standard install, not just our use case - can you help get this on radar?

silesky commented 2 months ago

Fixed in 1.72.0