Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node-gyp fails to build @parcel/watcher on node:18 image but succeeds with node:18-bullseye #9262

Closed
DreamwareDevelopment opened this issue Sep 21, 2023 · 8 comments

Comments

@DreamwareDevelopment
Copy link

DreamwareDevelopment commented Sep 21, 2023

🐛 bug report

I'm using NX which has a dependency on parcel and when building my image I got a node-gyp failure. Following along with this isssue I changed the image to bullseye and boom, it works. Not really sure why though.

🎛 Configuration (.babelrc, package.json, cli command)

package.json

{
  "name": "@dreamware/source",
  "private": true,
  "type": "module",
  "dependencies": {
    "@fastify/autoload": "~5.7.1",
    "@fastify/middie": "^8.3.0",
    "@fastify/sensible": "~5.2.0",
    "@fastify/static": "^6.11.1",
    "@nx/devkit": "16.7.4",
    "@swc/helpers": "~0.5.0",
    "axios": "^1.0.0",
    "cross-env": "^7.0.3",
    "dotenv": "^16.3.1",
    "fastify": "~4.23.0",
    "fastify-plugin": "~4.5.0",
    "lightweight-charts": "^4.0.1",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-router-dom": "6.11.2",
    "sirv": "^2.0.3",
    "tslib": "^2.3.0",
    "vite-plugin-ssr": "^0.4.140"
  },
  "devDependencies": {
    "@nx-go/nx-go": "^2.7.0",
    "@nx/cypress": "16.7.4",
    "@nx/esbuild": "16.7.4",
    "@nx/eslint-plugin": "16.7.4",
    "@nx/jest": "16.7.4",
    "@nx/js": "16.7.4",
    "@nx/linter": "16.7.4",
    "@nx/node": "16.7.4",
    "@nx/plugin": "16.7.4",
    "@nx/react": "16.7.4",
    "@nx/vite": "16.7.4",
    "@nx/workspace": "16.7.4",
    "@nxlv/python": "^16.1.2",
    "@swc-node/register": "~1.4.2",
    "@swc/cli": "~0.1.62",
    "@swc/core": "~1.3.51",
    "@testing-library/react": "14.0.0",
    "@types/jest": "^29.4.0",
    "@types/node": "18.14.2",
    "@types/react": "18.2.14",
    "@types/react-dom": "18.2.6",
    "@typescript-eslint/eslint-plugin": "5.62.0",
    "@typescript-eslint/parser": "5.62.0",
    "@vitejs/plugin-react": "~4.0.0",
    "cypress": "^12.16.0",
    "esbuild": "^0.17.17",
    "eslint": "8.46.0",
    "eslint-config-prettier": "8.1.0",
    "eslint-plugin-cypress": "2.14.0",
    "eslint-plugin-import": "2.27.5",
    "eslint-plugin-jsx-a11y": "6.7.1",
    "eslint-plugin-react": "7.32.2",
    "eslint-plugin-react-hooks": "4.6.0",
    "jest": "^29.4.1",
    "jest-environment-jsdom": "^29.4.1",
    "jest-environment-node": "^29.4.1",
    "jsdom": "~22.1.0",
    "nx": "16.7.4",
    "nx-cloud": "16.4.0",
    "prettier": "^2.6.2",
    "sass": "^1.55.0",
    "ts-jest": "^29.1.0",
    "typescript": "~5.1.3",
    "vavite": "^2.0.1",
    "vite": "~4.3.9",
    "vite-tsconfig-paths": "~4.2.0",
    "vitest": "~0.32.0"
  },
}

Dockerfile

FROM node:18

WORKDIR /

COPY package.json yarn.lock ./
RUN yarn install --production --frozen-lockfile
...

🤔 Expected Behavior

Parcel should build on Node:18 image

😯 Current Behavior

From Node:18 image

#8 27.06 error /node_modules/@parcel/watcher: Command failed.
#8 27.06 Exit code: 1
#8 27.06 Command: node-gyp-build
#8 27.06 Arguments: 
#8 27.06 Directory: /node_modules/@parcel/watcher
#8 27.06 Output:
#8 27.06 node:events:495
#8 27.06       throw er; // Unhandled 'error' event
#8 27.06       ^
#8 27.06 
#8 27.06 Error: spawn node-gyp ENOENT
#8 27.06     at ChildProcess._handle.onexit (node:internal/child_process:284:19)
#8 27.06     at onErrorNT (node:internal/child_process:477:16)
#8 27.06     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
#8 27.06 Emitted 'error' event on ChildProcess instance at:
#8 27.06     at ChildProcess._handle.onexit (node:internal/child_process:290:12)
#8 27.06     at onErrorNT (node:internal/child_process:477:16)
#8 27.06     at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
#8 27.06   errno: -2,
#8 27.06   code: 'ENOENT',
#8 27.06   syscall: 'spawn node-gyp',
#8 27.06   path: 'node-gyp',
#8 27.06   spawnargs: [ 'rebuild' ]
#8 27.06 }
#8 27.06 
#8 27.06 Node.js v18.18.0
#8 27.06 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
#8 ERROR: process "/bin/sh -c yarn install --production --frozen-lockfile" did not complete successfully: exit code: 1
------
 > [3/7] RUN yarn install --production --frozen-lockfile:
27.06     at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
27.06   errno: -2,
27.06   code: 'ENOENT',
27.06   syscall: 'spawn node-gyp',
27.06   path: 'node-gyp',
27.06   spawnargs: [ 'rebuild' ]
27.06 }
27.06 
27.06 Node.js v18.18.0
27.06 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

💻 Code Sample

I believe with the package.json and Dockerfile you should be able to repro it on an M1 Mac.

🌍 Your Environment

Software Version(s)
Parcel @parcel/watcher@2.0.4
Node 18.18.0
npm/Yarn yarn 1.22.19
Operating System OSX 13.5.2 (22G91)
@theskcd
Copy link

theskcd commented Sep 22, 2023

Hey guys! We are seeing a similar issue on our prod deployment on M1 machines, it broke 2 days ago but was working before that.

@theofrgs
Copy link

Hello, on mac too, same error, does somoene on linux or windows have this issues ?

@filipsuk
Copy link

We had a same issue since few days ago in our gitlab pipelines running on arm cpus. We reverted from node:18 docker image to an older version node@sha256:c85dc4392f44f5de1d0d72dd20a088a542734445f99bed7aa8ac895c706d370d and it worked.

@kmashint
Copy link

kmashint commented Oct 7, 2023

I'm seeing the same "binding.gyp not found" on both Windows 10 with Python 3.12 and OSX 12.6.5 with Python 3.10. I've tried both node.js 18 and 16, maybe I'll try a slightly older minor version of node.js. Someone on stackoverflow.com mentioned that node.js 17 worked, but that's not LTS. node-gyp is painful.

@genffy
Copy link

genffy commented Oct 31, 2023

try use npm i --ignore-scripts

@rconjoe
Copy link

rconjoe commented Oct 31, 2023

Experienced this as well on vercel CI runners running pnpm install on the 18.x runtime. @genffy's fix appears to have solved the issue but I haven't figured out why. thanks @genffy

@cyrus-za
Copy link

cyrus-za commented Nov 6, 2023

gentify's issue means it wont do any postinstall which means it wont try and install parcel-watcher. This works if thats the only postinstall one needs, but in our case we got several tools we need with postinstall so that command won't work for us.

@mischnic
Copy link
Member

mischnic commented Nov 7, 2023

See parcel-bundler/watcher#156

@mischnic mischnic closed this as not planned Won't fix, can't repro, duplicate, stale Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants