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

Installing electron on MacOS Catalina #2257

Closed
captain-kark opened this issue Nov 11, 2020 · 8 comments
Closed

Installing electron on MacOS Catalina #2257

captain-kark opened this issue Nov 11, 2020 · 8 comments
Labels

Comments

@captain-kark
Copy link

# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
This module contains classes that help to emulate xcodebuild behavior on top of
other build systems, such as make and ninja.
"""

If this were replaced with this, it should work.

+#!/usr/bin/python2.7 
 # Copyright (c) 2012 Google Inc. All rights reserved. 
 # Use of this source code is governed by a BSD-style license that can be  
 # found in the LICENSE file. 
  
 """ 
 This module contains classes that help to emulate xcodebuild behavior on top of 
 other build systems, such as make and ninja. 
 """ 

I fixed it locally by running PYENV_VERSION=system npm i while looking into this in a related issue elsewhere. Here's a relevant section of my stacktrace that brought me here.

    prebuild-install WARN install No prebuilt binaries found (target=8.5.2 runtime=electron arch=x64 libc= platform=darwin)

  ⨯ cannot execute  cause=exit status 1
                    out=
    > @journeyapps/[email protected] install ~/Signal-Desktop/node_modules/@journeyapps/sqlcipher
    > node-pre-gyp install --build-from-source

    Failed to execute '~/.nvm/versions/node/v12.13.0/bin/node ~/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --build-from-source --module=/U
sers/kark/code/Signal-Desktop/node_modules/@journeyapps/sqlcipher/lib/binding/electron-v8.5-darwin-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=~/code/Signal-Desktop/node_modules/@jour
neyapps/sqlcipher/lib/binding/electron-v8.5-darwin-x64 --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=electron-v8.5' (1)

                    errorOut=node-pre-gyp WARN Using request for node-pre-gyp https download
    Traceback (most recent call last):
      File "~/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 50, in <module>
        sys.exit(gyp.script_main())
      File "~/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 554, in script_main
        return main(sys.argv[1:])
      File "~/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 547, in main
        return gyp_main(args)
      File "~/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 532, in gyp_main
        generator.GenerateOutput(flat_list, targets, data, params)
      File "~/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 2214, in GenerateOutput
        writer.Write(qualified_target, base_path, output_file, spec, configs,
      File "~/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 793, in Write
        self.WriteActions(spec['actions'], extra_sources, extra_outputs,
      File "~/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 900, in WriteActions
        env = self.GetSortedXcodeEnv()
      File "~/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 1882, in GetSortedXcodeEnv
        return gyp.xcode_emulation.GetSortedXcodeEnv(
      File "~/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1615, in GetSortedXcodeEnv
        env = _GetXcodeEnv(xcode_settings, built_products_dir, srcroot, configuration,
      File "~/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1527, in _GetXcodeEnv
        if XcodeVersion() >= '0500' and not env.get('SDKROOT'):
    TypeError: '>=' not supported between instances of 'tuple' and 'str'
@cclauss
Copy link
Contributor

cclauss commented Nov 11, 2020

@cclauss cclauss closed this as completed Nov 11, 2020
@captain-kark
Copy link
Author

captain-kark commented Nov 11, 2020

The project in question is a fork of a dependency maintained by someone at Signal.

https://github.com/signalapp/Signal-Desktop/tree/89d5972522a555723034b59f9fe20afdbd120eb8 has the node engine set to 12.13.0 so I'm set using what they expect.

Closing Closed. Is a duplicate of

#1941 (comment)
nodejs/node#30129 (comment)

@captain-kark
Copy link
Author

captain-kark commented Nov 11, 2020

In case you wanted to see what the actual code is, https://github.com/nodejs/node-gyp/blob/v5.0.4/gyp/pylib/gyp/xcode_emulation.py#L1527 is what gets used when you set your project's node engine to 12.13.0

@cclauss
Copy link
Contributor

cclauss commented Nov 11, 2020

Try https://github.com/nodejs/node-gyp#configuring-python-dependency

@captain-kark
Copy link
Author

A shebang allows the author to specify a python dependency when it's known that a specific version of a scripting language is needed to run the script properly. Without it, the user's current interpreter is used, which in a lot of cases today is python3.

@cclauss
Copy link
Contributor

cclauss commented Nov 11, 2020

Yes. Because Python 2 died on 1/1/2020.

@captain-kark
Copy link
Author

It might make more sense to ship these scripts with a shebang pointing to python3 once they're converted, so that this exact same thing doesn't happen again in 5 or 10 years. It's not as if the PSF issued a global cease and desist on the first of this year, requiring the deletion all python2 binaries in the wild.

@cclauss
Copy link
Contributor

cclauss commented Nov 11, 2020

Please stop. We have discussed have 5 different ways to solve your problem of using code that is no longer supported.

Shebang lines are only useful in files that are meant to be executed in a standalone fashion. If this file is executed in a standalone fashion then nothing will happen because this file contains functions and classes that are called from other files. It is not useful or customary to add a shebang to such files.

The current node-gyp is perfectly compatible with Node.js v12.13.0 and with Python 3.9 so if you choose not to upgrade, please do not create issues that assert that it is a necessity to move backwards.

@cclauss cclauss changed the title Python 2.7 required for installation in electron on MacOS Catalina Installing electron on MacOS Catalina Dec 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants