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 does not appear to be available in GH actions anymore #633

Closed
johrstrom opened this issue Sep 28, 2023 · 6 comments · Fixed by #635
Closed

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

johrstrom opened this issue Sep 28, 2023 · 6 comments · Fixed by #635
Labels
Milestone

Comments

@johrstrom
Copy link

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.

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).

@Tyriar
Copy link
Member

Tyriar commented Sep 28, 2023

It's not a dependency as I'm pretty sure node-gyp used to be bundled with node.js, we might need to change that

@Tyriar Tyriar added the debt label Sep 28, 2023
@johrstrom
Copy link
Author

OK weird - I setup a test repository (https://github.com/johrstrom/test_node_gyp) (just to make sure I'm not insane) and see this message - which I don't see in the code base that I'm getting this error out of.

info This package requires node-gyp, which is not currently installed. Yarn will attempt to automatically install it. If this fails, you can run "yarn global add node-gyp" to manually install it.

And since it says that - it works because it automatically installed it.

@Tyriar
Copy link
Member

Tyriar commented Sep 28, 2023

@johrstrom
Copy link
Author

OK - I cannot replicate the issue in a simple demonstrative project. It acknowledges that node-gyp is not there and installs it.

image

Not really sure why my original project doesn't have the same behavior, but it's clearly an environmental issue.

@johrstrom
Copy link
Author

OH! got it to replicate using version 0.9.0. Maybe all I have to do is update lol. Sorry for the noise - I thought it would be helpful in case other users see the same.

@johrstrom
Copy link
Author

Feel free to close this as it doesn't even seem to impact 1.0.0 and users on 0.9.0 have a workaround.

IDK if there's anything to be done on your side - but I'm more of a ruby developer so there could be some node.js nuance I'm missing.

Tyriar added a commit that referenced this issue Oct 2, 2023
@Tyriar Tyriar added this to the 1.1.0 milestone Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants