Open bolt-juri-gavshin opened 5 months ago
Not sure if this is the place, but I am seeing an error related to node-gyp from 20.12.0 as well. Basically
binding.gyp not found (cwd: /__t/node/21.7.2/x64/lib/node_modules/@platformos/pos-cli/node_modules/fsevents) while trying to load binding.gyp
while installing a package that was working before without any changes. Falling back to Node 20.11 fixes this problem.
I can provide more details if needed, but the package in question is https://github.com/mdyd-dev/pos-cli and switching Node versions is everything one needs to reproduce it. Fails only on Linux (and possibly OSX), I am using mcr.microsoft.com/playwright:v1.42.1-jammy
, seems to be working on Windows.
To reproduce on Node 20.12.1:
npm i -g @platformos/pos-cli
UPDATE: I tried updating all of the dependencies to see if that changes anything but it doesn't.
To update this issue as I did some further investigating. It seems that the issue is not strictly corresponding to Node, but to npm
version that Node comes with. I have tested npm i -g @platformos/pos-cli
on Node 22.12.2 and npm@10.4.0 and above and it does not work. But when I've downgraded npm to 10.3.0 everything works, even on 22.12.2.
@bolt-juri-gavshin - would you be able to confirm?
Downgrading to NPM 10.3.0 helps in "my real-world usage scenario", even if NodeJS 20.12.2 is used (on linux/x86_64 and linux/arm64). For some reason, my example Dockerfile still fails, even if NPM is downgraded to 10.3.0.
Also, pnpm
does not have any problems here.
Ok, so in my case the problematic package seems to be chokidar
. I've replaced it with @parcel/watch
and it seems to be working. The downside is that we were using LiveReload as well that directly depends on chokidar
and the only working solution I've found was to remove it from the package. Nothing else was working.
Update: It looks like NodeJS in 20.14.0 (NPM 10.7.0) the problem is fixed. This Dockerfile works now:
FROM node:20.14.0-bookworm
WORKDIR /app
RUN echo 'foreground-scripts = true' >> .npmrc
RUN npm install rocksdb@5.2.1 --force --loglevel=verbose
For me nothing changed in terms of my package, but I have found a fix.
npm i fsevents@latest -f --save-optional
Fixes the problem for some reason, thus I think there is something wrong in newest npm
with managing optional dependencies, but I am not skilled enough in Node to investigate further.
Version
20.12.0
Platform
x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
Build the following Dockerfile
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
Same as in 20.11.1:
What do you see instead?
Additional information
Not sure, whether the bug is in NodeJS or
rocksdb
ornode-gyp-build
, but this code worked fine in NodeJS 16, 18 and 20.11.