Skip to content

node-gyp does not appear to be available in GH actions anymore #633

@johrstrom

Description

@johrstrom

Environment details

  • OS: github actions (ubuntu-latest)
  • OS version: Ubuntu 22.04
  • node-pty version: 0.9.0

Issue description

node-gyp doesn't appear to be available in Github actions anymore. I'm not quite sure when this changed, but our builds started to fail maybe a week ago with this error below (it was flaky for some time, but now reliably fails).

Basically trying to install this package failed because node-gyp does not appear to be in the PATH.

Details
tmp/node_modules/yarn/bin/yarn --production install --flat --cache-folder /home/runner/.cache/yarn/ood-shell-app
yarn install v1.22.19
[1/4] Resolving packages...
warning Lockfile has incorrect entry for "ms@2.0.0". Ignoring it.
warning Lockfile has incorrect entry for "inherits@2.0.4". Ignoring it.
warning Lockfile has incorrect entry for "ms@2.1.3". Ignoring it.
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error /home/runner/work/ondemand/ondemand/apps/shell/node_modules/node-pty: Command failed.
Exit code: 1
Command: node scripts/install.js
Arguments: 
Directory: /home/runner/work/ondemand/ondemand/apps/shell/node_modules/node-pty
Output:
node:events:495
      throw er; // Unhandled 'error' event
      ^

Error: spawn node-gyp ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:284:19)
    at onErrorNT (node:internal/child_process:477:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess._handle.onexit (node:internal/child_process:290:12)
    at onErrorNT (node:internal/child_process:477:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn node-gyp',
  path: 'node-gyp',
  spawnargs: [ 'rebuild' ]
}

The fix was just to add a step like so

     - name: Setup Node.js
        run: |
          npm install -g node-gyp

This issue is half a heads up as others may encounter the same, the other half wondering why it's not a dependency? I would guess there's an assumption that the nodejs you've installed through your system package manager also installed this module?

In any case - feel free to close as it really is just a informational ticket to let folks know should they run into the same issue. (I could setup a simple CI to demonstrate the same and can do so if you like/need).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions