cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
47.02k stars 3.18k forks source link

Update to minimum node-gyp 9.1 for build on Windows #28766

Open MikeMcC399 opened 9 months ago

MikeMcC399 commented 9 months ago

What would you like?

Enable building Cypress from source on Windows with node-gyp@9.1.0 or later when executing yarn on this repository according to CONTRIBUTING > Getting Started.

Why is this needed?

node-gyp recommends for Windows:

Install Visual C++ Build Environment: Visual Studio Build Tools (using "Visual C++ build tools" if using a version older than VS2019, otherwise use "Desktop development with C++" workload) or Visual Studio Community (using the "Desktop development with C++" workload)

Other

The version of node-gyp used is not explicitly specified by Cypress. It is dependent on the versions of other npm modules installed such as semantic-release and lerna.

Note that this enhancement request is not sufficient to support building with Python 3.12. This would require a minimum of node-gyp@10.0.0 which takes care of the removal of distutils in Python 3.12.

MikeMcC399 commented 9 months ago

In Cypress 13.6.4, node-gyp@8.4.1 is used: (also true for Cypress 13.7.1)

$ yarn why node-gyp
yarn why v1.22.21
[1/4] Why do we have the module "node-gyp"...?
[2/4] Initialising dependency graph...
warning Resolution field "pretty-format@26.4.0" is incompatible with requested version "pretty-format@29.4.3"
warning Resolution field "pretty-format@26.4.0" is incompatible with requested version "pretty-format@^27.0.2"
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "node-gyp@9.0.0"
info Has been hoisted to "node-gyp"
info Reasons this module exists
   - "workspace-aggregator-fcd5eb41-6c99-41cd-b776-c2abefb56723" depends on it
   - Hoisted from "_project_#@packages#server#@electron#rebuild#node-gyp"
   - Hoisted from "_project_#lerna#@npmcli#run-script#node-gyp"
   - Hoisted from "_project_#pacote#@npmcli#run-script#node-gyp"
   - Hoisted from "_project_#@npmcli#arborist#@npmcli#run-script#node-gyp"
   - Hoisted from "_project_#lerna#@lerna#legacy-package-management#@npmcli#run-script#node-gyp"
   - Hoisted from "_project_#lerna#@npmcli#arborist#@npmcli#run-script#node-gyp"
   - Hoisted from "_project_#lerna#pacote#@npmcli#run-script#node-gyp"
   - Hoisted from "_project_#semantic-release#@semantic-release#npm#npm#node-gyp"
   - Hoisted from "_project_#lerna#@lerna#legacy-package-management#@npmcli#arborist#@npmcli#run-script#node-gyp"
   - Hoisted from "_project_#lerna#@lerna#create#pacote#@npmcli#run-script#node-gyp"
   - Hoisted from "_project_#lerna#@lerna#legacy-package-management#pacote#@npmcli#run-script#node-gyp"
   - Hoisted from "_project_#lerna#@npmcli#arborist#@npmcli#metavuln-calculator#pacote#@npmcli#run-script#node-gyp"
   - Hoisted from "_project_#lerna#@lerna#legacy-package-management#@npmcli#arborist#@npmcli#metavuln-calculator#pacote#@npmcli#run-script#node-gyp"
info Disk size without dependencies: "2.38MB"
info Disk size with unique dependencies: "5.47MB"
info Disk size with transitive dependencies: "8.69MB"
info Number of shared dependencies: 86
=> Found "@npmcli/run-script#node-gyp@8.4.1"
info This module exists because "_project_#@npmcli#run-script" depends on it.
info Disk size without dependencies: "2.56MB"
info Disk size with unique dependencies: "5.65MB"
info Disk size with transitive dependencies: "8.86MB"
info Number of shared dependencies: 86
Done in 2.21s.
MikeMcC399 commented 1 month ago

Cypress has made some progress towards node-gyp 9.1 as minimum.

The current minimum version used is node-gyp@9.0.0 in cypress@13.14.2:

$ yarn why node-gyp
yarn why v1.22.22
[1/4] Why do we have the module "node-gyp"...?
[2/4] Initialising dependency graph...
warning Resolution field "pretty-format@26.4.0" is incompatible with requested version "pretty-format@29.4.3"
warning Resolution field "devtools-protocol@0.0.1346313" is incompatible with requested version "devtools-protocol@0.0.927104"
warning Resolution field "devtools-protocol@0.0.1346313" is incompatible with requested version "devtools-protocol@0.0.1159816"
warning Resolution field "pretty-format@26.4.0" is incompatible with requested version "pretty-format@^27.0.2"
warning Resolution field "vue-template-compiler@2.6.12" is incompatible with requested version "vue-template-compiler@^2.7.14"
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "node-gyp@9.0.0"
info Has been hoisted to "node-gyp"
info Reasons this module exists
   - "workspace-aggregator-8230f893-66cd-428f-855e-4413c39e4f0c" depends on it
   - Hoisted from "_project_#@packages#server#@electron#rebuild#node-gyp"
   - Hoisted from "_project_#lerna#@npmcli#run-script#node-gyp"
   - Hoisted from "_project_#lerna#@lerna#legacy-package-management#@npmcli#run-script#node-gyp"
   - Hoisted from "_project_#lerna#@npmcli#arborist#@npmcli#run-script#node-gyp"
   - Hoisted from "_project_#lerna#pacote#@npmcli#run-script#node-gyp"
   - Hoisted from "_project_#@cypress#schematic#@angular#cli#pacote#@npmcli#run-script#node-gyp"
   - Hoisted from "_project_#lerna#@lerna#legacy-package-management#@npmcli#arborist#@npmcli#run-script#node-gyp"
   - Hoisted from "_project_#lerna#@lerna#create#pacote#@npmcli#run-script#node-gyp"
   - Hoisted from "_project_#lerna#@lerna#legacy-package-management#pacote#@npmcli#run-script#node-gyp"
   - Hoisted from "_project_#lerna#@npmcli#arborist#@npmcli#metavuln-calculator#pacote#@npmcli#run-script#node-gyp"
   - Hoisted from "_project_#lerna#@lerna#legacy-package-management#@npmcli#arborist#@npmcli#metavuln-calculator#pacote#@npmcli#run-script#node-gyp"
info Disk size without dependencies: "3.42MB"
info Disk size with unique dependencies: "8.92MB"
info Disk size with transitive dependencies: "15.25MB"
info Number of shared dependencies: 81
=> Found "@npmcli/run-script#node-gyp@10.2.0"
info This module exists because "_project_#@npmcli#run-script" depends on it.
info Disk size without dependencies: "2.54MB"
info Disk size with unique dependencies: "6.15MB"
info Disk size with transitive dependencies: "11.69MB"
info Number of shared dependencies: 58
=> Found "npm#node-gyp@10.2.0"
info This module exists because "_project_#semantic-release#@semantic-release#npm#npm" depends on it.
info Disk size without dependencies: "1.79MB"
info Disk size with unique dependencies: "5.39MB"
info Disk size with transitive dependencies: "10.93MB"
info Number of shared dependencies: 58
jennifer-shehane commented 1 month ago

@MikeMcC399 I feel like this changes in our Electron 29 branch - there was some battles we were having with node-gyp but I can't remember where it landed.

MikeMcC399 commented 1 month ago

The minimum in branch https://github.com/cypress-io/cypress/tree/electron-29 is still node-gyp@9.0.0.