Skip to content

[Solutions Provided] Not compatible with Python > 3.12 #40

@varjmes

Description

@varjmes

Hi! Just checking out the tool as a new-to-runescape guy and had a build error after npm install. I had the same issue myself at work the other day so figured I'd let everyone know how to remedy the issue!

The error logs, platform: MacOS
> alt1lite@0.0.1 install
> npm run native


> alt1lite@0.0.1 native
> npm run nativerelease -- --debug


> alt1lite@0.0.1 nativerelease
> electron-rebuild -f -w alt1lite --debug

⠇ Building module: alt1-electron, Completed: 0Traceback (most recent call last):
  File "/Users/varjmes/alt1-electron/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>
    import gyp  # noqa: E402
    ^^^^^^^^^^
  File "/Users/varjmes/alt1-electron/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 9, in <module>
    import gyp.input
  File "/Users/varjmes/alt1-electron/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in <module>
    from distutils.version import StrictVersion
ModuleNotFoundError: No module named 'distutils'
✖ Rebuild Failed

An unhandled error occurred inside electron-rebuild
node-gyp failed to rebuild '/Users/varjmes/alt1-electron'.
For more information, rerun with the DEBUG environment variable set to "electron-rebuild".

Error: `gyp` failed with exit code: 1



Error: node-gyp failed to rebuild '/Users/varjmes/alt1-electron'.
For more information, rerun with the DEBUG environment variable set to "electron-rebuild".

Error: `gyp` failed with exit code: 1


    at NodeGyp.rebuildModule (/Users/varjmes/alt1-electron/node_modules/electron-rebuild/lib/src/module-type/node-gyp.js:120:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ModuleRebuilder.rebuildNodeGypModule (/Users/varjmes/alt1-electron/node_modules/electron-rebuild/lib/src/module-rebuilder.js:98:9)
    at async ModuleRebuilder.rebuild (/Users/varjmes/alt1-electron/node_modules/electron-rebuild/lib/src/module-rebuilder.js:128:14)
    at async Rebuilder.rebuildModuleAt (/Users/varjmes/alt1-electron/node_modules/electron-rebuild/lib/src/rebuild.js:149:13)
    at async Rebuilder.rebuild (/Users/varjmes/alt1-electron/node_modules/electron-rebuild/lib/src/rebuild.js:112:17)
    at async /Users/varjmes/alt1-electron/node_modules/electron-rebuild/lib/src/cli.js:158:9
npm notice
npm notice New major version of npm available! 9.8.0 -> 11.3.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.3.0
npm notice Run npm install -g npm@11.3.0 to update!
npm notice
npm ERR! code 255
npm ERR! path /Users/varjmes/alt1-electron
npm ERR! command failed
npm ERR! command sh -c npm run native

distutils was removed from Python in version 3.12, and node-gyp relies on that to build.

There are a few things you can do.

  1. Downgrade Python

I use pyenv for python version management so I can do the following

> pyenv install 3.10 
> pyenv local 3.10
> npm i
  1. Stay on 3.12, install setuptools
> python3 -m pip install setuptools
> npm i
  1. Users do nothing, codebase maintainers upgrade their electron-rebuild package

electron-rebuild is a deprecated package, electron rescoped it to @electron/rebuild
In v3.7.0 they claim to fix the node-gyp issue :)
I'd PR it myself but I'm unfamiliar with the codebase/electron and its quite a few minor versions (and technically a different package) up.


I can't say the alt1-electron package works after that because I then get a bunch of other build errors. But thats related to me being on MacOS (M1) and I know this is a work-in-progress project. And these remedies above should help people some of the way through building it :)

Good luck with the project, and happy skilling! ⛏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions