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

Requirement of node-ssh in baremetal deploy option blows up on some systems because of node-gyp (or lack of it?) #4930

Closed
cannikin opened this issue Mar 25, 2022 · 0 comments · Fixed by #4931

Comments

@cannikin
Copy link
Member

Reported in Slack:

Tobbe Lundberg Yesterday at 4:42 PM
I've started getting errors like this on RW projects. Anyone else seen this?
warning Error running install script for optional dependency: "/Users/tobbe/dev/redwood/thing/node_modules/cpu-features: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /Users/tobbe/dev/redwood/thing/node_modules/cpu-features
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | arm64
gyp info find Python using Python version 3.9.7 found at "/opt/homebrew/opt/[email protected]/bin/python3.9"
12 replies

Peter Colapietro 18 hours ago
I think I saw this in CI/CD but it didn't result in a deploy failure so I didn't look further into it

Tobbe Lundberg 18 hours ago
Yeah, it's just a warning. But it's a scary looking one

Tobbe Lundberg 18 hours ago
Further down you get this
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (node:events:520:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Darwin 21.3.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/tobbe/dev/redwood/thing/node_modules/cpu-features
gyp ERR! node -v v16.14.0
gyp ERR! node-gyp -v v8.4.1
gyp ERR! not ok"

Tobbe Lundberg 18 hours ago
Followed up by
info This module is OPTIONAL, you can safely ignore this error
Which is good. But I'd still rather not have the warning at all.

Peter Colapietro 18 hours ago
Found it in a my CI/CD logs on netlify:
...
5:27:26 PM: ➤ YN0007: │ ssh2@npm:1.7.0 must be built because it never has been before or the last one failed
5:27:27 PM: ➤ YN0000: │ ssh2@npm:1.7.0 STDOUT Usage Error: Couldn't find a script name "node-gyp" in the top-level (used by ssh2@npm:1.7.0). This typically happens because some package depends on "node-gyp" to build itself, but didn't list it in their dependencies. To fix that, please run "yarn add node-gyp" into your top-level workspace. You also can open an issue on the repository of the specified package to suggest them to use an optional peer dependency.
5:27:27 PM: ➤ YN0000: │ ssh2@npm:1.7.0 STDOUT
5:27:27 PM: ➤ YN0000: │ ssh2@npm:1.7.0 STDOUT $ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] ...
5:27:27 PM: ➤ YN0000: │ ssh2@npm:1.7.0 STDOUT Failed to build optional crypto binding
5:27:27 PM: ➤ YN0000: └ Completed in 19s 492ms
5:27:28 PM: ➤ YN0000: Done with warnings in 41s 206ms
...

David Price 18 hours ago
gyp Errors normally are OS-specific. For me most often related to upgrades with XCode and/or MacOS.
Maybe gyp released a new version recently??

David Price 18 hours ago
So annoying

Tobbe Lundberg 18 hours ago
Could we lazyload the node-ssh dependency?

Tobbe Lundberg 18 hours ago
And make it optional so it's only installed if you want to do baremetal deploys?

David Price 18 hours ago
yep, exactly. I can’t get to it. But we should at least create an issue. Patch worthy for sure

Simon Gagnon 4 hours ago
https://community.redwoodjs.com/t/problem-w-tutorial-on-fresh-monterey/2918/2
Seem to be related, and he found the solution ! (edited)

RedwoodJS CommunityRedwoodJS Community
Problem w/tutorial on fresh Monterey
To Infinity ! and Beyond !! Both upgrading to macOS Catalina and running a Software Update in Catalina may cause normal node-gyp installations to fail. node-gyp/macOS_Catalina.md
Today at 5:35 AM (367 kB)
https://community.redwoodjs.com/t/problem-w-tutorial-on-fresh-monterey/2918/2[](https://community.redwoodjs.com/t/problem-w-tutorial-on-fresh-monterey/2918/2)

Peter Colapietro 3 hours ago
:thinking_face:
This does beg an interesting question around how we might list out the technical requirements brought about by the transitive dependencies we use.
What we are running into here:
node-ssh -> ssh2 -> cpu_features
Where then cpu_features calls node-gyp when installed.
Relevant to this topic:
mscdex/ssh2#1083
mscdex/ssh2#1114

cannikin added a commit that referenced this issue Mar 25, 2022
thedavidprice added a commit that referenced this issue Mar 26, 2022
)

* Removes node-ssh dependency

* Move node-ssh require to invoking function

* Add node-ssh to dependencies at setup time

Closes #4930

Co-authored-by: David Price <[email protected]>
thedavidprice added a commit that referenced this issue Mar 31, 2022
)

* Removes node-ssh dependency

* Move node-ssh require to invoking function

* Add node-ssh to dependencies at setup time

Closes #4930

Co-authored-by: David Price <[email protected]>
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

Successfully merging a pull request may close this issue.

2 participants