Skip to content

Update Electron to 28.0.0#35776

Merged
ravicious merged 5 commits intomasterfrom
r7s/electron-28
Dec 18, 2023
Merged

Update Electron to 28.0.0#35776
ravicious merged 5 commits intomasterfrom
r7s/electron-28

Conversation

@ravicious
Copy link
Copy Markdown
Member

@ravicious ravicious commented Dec 15, 2023

Changelog: Changed the minimal supported macOS version of Teleport Connect to 10.15 (Catalina)

We already updated Electron to v26 a while ago (#30679, #31802), but we had to roll back the changes due to issues on Linux.

There's no breaking changes which would affect us, other than the fact that v27 dropped support for macOS 10.13 and 10.14. I asked on Slack if we should update operating system support in docs, but it looks like the page is incorrect anyway.

I tested the changes on macOS, Windows (Parallels) and Linux (x64 in VirtualBox on Intel MBP) against the checklist for both Electron and electron-builder. There have been no changes in electron-builder to Linux install scripts. The dev tag is 15.0.0-dev.ravicious.5. It wasn't promoted, but the artifacts can be downloaded from S3.

Now, I had to update a bunch of deps. Upgrading just Electron resulted in an error when building native deps:

Details
    /Users/rav/.electron-gyp/28.0.0/include/node/v8-local-handle.h:261:5: error: static assertion failed due to requirement 'std::is_base_of<v8::Value, v8::Data>::value': type check
        static_assert(std::is_base_of<T, S>::value, "type check");
        ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ electron-builder install-app-deps
  • electron-builder  version=24.9.4
  • rebuilding native dependencies  dependencies=node-pty@1.1.0-beta5 platform=darwin arch=arm64
  • rebuilding native dependency  name=node-pty version=1.1.0-beta5
  ⨯ cannot execute  cause=exit status 1
$ node-gyp rebuild

      CXX(target) Release/obj.target/pty/src/unix/pty.o
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

                    errorOut=gyp info it worked if it ends with ok
    gyp info using node-gyp@10.0.1
    gyp info using node@18.19.0 | darwin | arm64
    gyp info find Python using Python version 3.11.6 found at "/opt/homebrew/opt/python@3.11/bin/python3.11"
    gyp info spawn /opt/homebrew/opt/python@3.11/bin/python3.11
    gyp info spawn args [
    gyp info spawn args '/opt/homebrew/Cellar/node@18/18.19.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
    gyp info spawn args 'binding.gyp',
    gyp info spawn args '-f',
    gyp info spawn args 'make',
    gyp info spawn args '-I',
    gyp info spawn args '/Users/rav/src/teleport/node_modules/node-pty/build/config.gypi',
    gyp info spawn args '-I',
    gyp info spawn args '/opt/homebrew/Cellar/node@18/18.19.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
    gyp info spawn args '-I',
    gyp info spawn args '/Users/rav/.electron-gyp/28.0.0/include/node/common.gypi',
    gyp info spawn args '-Dlibrary=shared_library',
    gyp info spawn args '-Dvisibility=default',
    gyp info spawn args '-Dnode_root_dir=/Users/rav/.electron-gyp/28.0.0',
    gyp info spawn args '-Dnode_gyp_dir=/opt/homebrew/Cellar/node@18/18.19.0/lib/node_modules/npm/node_modules/node-gyp',
    gyp info spawn args '-Dnode_lib_file=/Users/rav/.electron-gyp/28.0.0/<(target_arch)/node.lib',
    gyp info spawn args '-Dmodule_root_dir=/Users/rav/src/teleport/node_modules/node-pty',
    gyp info spawn args '-Dnode_engine=v8',
    gyp info spawn args '--depth=.',
    gyp info spawn args '--no-parallel',
    gyp info spawn args '--generator-output',
    gyp info spawn args 'build',
    gyp info spawn args '-Goutput_dir=.'
    gyp info spawn args ]
    gyp info spawn make
    gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
    In file included from ../src/unix/pty.cc:20:
    ../../nan/nan.h:686:39: warning: 'IdleNotificationDeadline' is deprecated: Use MemoryPressureNotification() to influence the GC schedule. [-Wdeprecated-declarations]
        return v8::Isolate::GetCurrent()->IdleNotificationDeadline(
                                          ^
    /Users/rav/.electron-gyp/28.0.0/include/node/v8-isolate.h:1343:3: note: 'IdleNotificationDeadline' has been explicitly marked deprecated here
      V8_DEPRECATE_SOON(
      ^
    /Users/rav/.electron-gyp/28.0.0/include/node/v8config.h:561:41: note: expanded from macro 'V8_DEPRECATE_SOON'
    #   define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
                                            ^
    ../src/unix/pty.cc:536:28: warning: missing field 'filter' initializer [-Wmissing-field-initializers]
      struct kevent change = {0};
                               ^
    ../src/unix/pty.cc:556:29: warning: missing field 'filter' initializer [-Wmissing-field-initializers]
        struct kevent event = {0};
                                ^
    In file included from ../src/unix/pty.cc:20:
    In file included from ../../nan/nan.h:60:
    In file included from /Users/rav/.electron-gyp/28.0.0/include/node/node.h:79:
    In file included from /Users/rav/.electron-gyp/28.0.0/include/node/v8.h:24:
    In file included from /Users/rav/.electron-gyp/28.0.0/include/node/v8-array-buffer.h:12:
    /Users/rav/.electron-gyp/28.0.0/include/node/v8-local-handle.h:261:5: error: static assertion failed due to requirement 'std::is_base_of<v8::Value, v8::Data>::value': type check
        static_assert(std::is_base_of<T, S>::value, "type check");
        ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../nan/nan_callbacks_12_inl.h:175:20: note: in instantiation of function template specialization 'v8::Local<v8::Value>::Local<v8::Data>' requested here
          cbinfo(info, obj->GetInternalField(kDataIndex));
                       ^
    3 warnings and 1 error generated.
    make: *** [Release/obj.target/pty/src/unix/pty.o] Error 1
    gyp ERR! build error
    gyp ERR! stack Error: `make` failed with exit code: 2
    gyp ERR! stack at ChildProcess.<anonymous> (/opt/homebrew/Cellar/node@18/18.19.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
    gyp ERR! System Darwin 23.2.0
    gyp ERR! command "/opt/homebrew/Cellar/node@18/18.19.0/bin/node" "/opt/homebrew/Cellar/node@18/18.19.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
    gyp ERR! cwd /Users/rav/src/teleport/node_modules/node-pty
    gyp ERR! node -v v18.19.0
    gyp ERR! node-gyp -v v10.0.1
    gyp ERR! not ok
error Command failed with exit code 1.

                    command=/opt/homebrew/Cellar/node@18/18.19.0/bin/node /opt/homebrew/Cellar/yarn/1.22.19/libexec/bin/yarn.js run install
                    workingDir=/Users/rav/src/teleport/node_modules/node-pty

After this, I tried to update electron-builder. This did not solve the problem, so I attempted to update node-pty to 1.0.0. It also didn't help. I looked at which node-pty version VSCode was using which was 1.1.0-beta5. This didn't help either. Grzegorz figured out that it's a problem with nan, so I updated nan.

This appeared to solve the problem with building native deps. However, the newest version of electron-builder removed @electron/rebuild from deps and with it node-gyp was gone as a dependency too. electron-builder attempts to download node-gyp automatically if it's not present, but this just did not work in our CI:

Details
$ electron-builder build --config electron-builder-config.js --publish never -c.extraMetadata.name=teleport-connect -c.extraMetadata.version=15.0.0-dev.ravicious.4 --universal
  • electron-builder  version=24.9.4 os=22.6.0
  • loaded configuration  file=/Users/runner/work/teleport.e/teleport.e/web/packages/teleterm/electron-builder-config.js
  • rebuilding native dependencies  dependencies=node-pty@1.1.0-beta5 platform=darwin arch=x64
  • rebuilding native dependency  name=node-pty version=1.1.0-beta5
  ⨯ cannot execute  cause=exit status 1
                    out=$ node-gyp rebuild
    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.
    [1/4] Resolving packages...
    [2/4] Fetching packages...
    [3/4] Linking dependencies...
    [4/4] Building fresh packages...
    success Installed "node-gyp@10.0.1" with binaries:
          - node-gyp
    
      CXX(target) Release/obj.target/pty/src/unix/pty.o
      SOLINK_MODULE(target) Release/pty.node
      CXX(target) Release/obj.target/spawn-helper/src/unix/spawn-helper.o
      LINK(target) Release/spawn-helper
    $ node scripts/post-install.js
    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
    
                    errorOut=gyp info it worked if it ends with ok
    gyp info using node-gyp@10.0.1
    gyp info using node@18.18.2 | darwin | arm64
    gyp info find Python using Python version 3.11.6 found at "/Library/Frameworks/Python.framework/Versions/3.11/bin/python3"
    gyp http GET https://electronjs.org/headers/v28.0.0/node-v28.0.0-headers.tar.gz
    gyp http 200 https://artifacts.electronjs.org/headers/v28.0.0/node-v28.0.0-headers.tar.gz?force_headers_dist=1
    gyp http GET https://electronjs.org/headers/v28.0.0/SHASUMS256.txt
    gyp http 200 https://artifacts.electronjs.org/headers/v28.0.0/SHASUMS256.txt?force_headers_dist=1
    gyp info spawn /Library/Frameworks/Python.framework/Versions/3.11/bin/python3
    gyp info spawn args [
    gyp info spawn args '/Users/runner/.config/yarn/global/node_modules/node-gyp/gyp/gyp_main.py',
    gyp info spawn args 'binding.gyp',
    gyp info spawn args '-f',
    gyp info spawn args 'make',
    gyp info spawn args '-I',
    gyp info spawn args '/Users/runner/work/teleport.e/teleport.e/node_modules/node-pty/build/config.gypi',
    gyp info spawn args '-I',
    gyp info spawn args '/Users/runner/.config/yarn/global/node_modules/node-gyp/addon.gypi',
    gyp info spawn args '-I',
    gyp info spawn args '/Users/runner/.electron-gyp/28.0.0/include/node/common.gypi',
    gyp info spawn args '-Dlibrary=shared_library',
    gyp info spawn args '-Dvisibility=default',
    gyp info spawn args '-Dnode_root_dir=/Users/runner/.electron-gyp/28.0.0',
    gyp info spawn args '-Dnode_gyp_dir=/Users/runner/.config/yarn/global/node_modules/node-gyp',
    gyp info spawn args '-Dnode_lib_file=/Users/runner/.electron-gyp/28.0.0/<(target_arch)/node.lib',
    gyp info spawn args '-Dmodule_root_dir=/Users/runner/work/teleport.e/teleport.e/node_modules/node-pty',
    gyp info spawn args '-Dnode_engine=v8',
    gyp info spawn args '--depth=.',
    gyp info spawn args '--no-parallel',
    gyp info spawn args '--generator-output',
    gyp info spawn args 'build',
    gyp info spawn args '-Goutput_dir=.'
    gyp info spawn args ]
    gyp info spawn make
    gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
    In file included from ../src/unix/pty.cc:20:
    ../../nan/nan.h:688:39: warning: 'IdleNotificationDeadline' is deprecated: Use MemoryPressureNotification() to influence the GC schedule. [-Wdeprecated-declarations]
        return v8::Isolate::GetCurrent()->IdleNotificationDeadline(
                                          ^
    /Users/runner/.electron-gyp/28.0.0/include/node/v8-isolate.h:1343:3: note: 'IdleNotificationDeadline' has been explicitly marked deprecated here
      V8_DEPRECATE_SOON(
      ^
    /Users/runner/.electron-gyp/28.0.0/include/node/v8config.h:561:41: note: expanded from macro 'V8_DEPRECATE_SOON'
    #   define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
                                            ^
    ../src/unix/pty.cc:536:28: warning: missing field 'filter' initializer [-Wmissing-field-initializers]
      struct kevent change = {0};
                               ^
    ../src/unix/pty.cc:556:29: warning: missing field 'filter' initializer [-Wmissing-field-initializers]
        struct kevent event = {0};
                                ^
    3 warnings generated.
    gyp info ok 
    node:internal/modules/cjs/loader:1080
      throw err;
      ^
    
    Error: Cannot find module '/Users/runner/.config/yarn/global/scripts/post-install.js'
        at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
        at Module._load (node:internal/modules/cjs/loader:922:27)
        at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12)
        at node:internal/main/run_main_module:23:47 {
      code: 'MODULE_NOT_FOUND',
      requireStack: []
    }
    
    Node.js v18.18.2
    error Command failed with exit code 1.
    
                    command=/Users/runner/hostedtoolcache/node/18.18.2/arm64/bin/node /Users/runner/.cache/node/corepack/yarn/1.22.21/bin/yarn.js run install
                    workingDir=/Users/runner/work/teleport.e/teleport.e/node_modules/node-pty

So I added back node-gyp explicitly to our build deps.

@ravicious ravicious added this pull request to the merge queue Dec 18, 2023
Merged via the queue into master with commit cc0df50 Dec 18, 2023
@ravicious ravicious deleted the r7s/electron-28 branch December 18, 2023 09:52
@public-teleport-github-review-bot
Copy link
Copy Markdown

@ravicious See the table below for backport results.

Branch Result
branch/v12 Failed
branch/v13 Failed
branch/v14 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants