Skip to content

Update to Python 3  #48

@Jeroendevr

Description

@Jeroendevr

On the main page of the screeps server it states only Python 2 is supported. Meanwhile there have been some updates to node-gyp and now supports Python 3. From version 5.0.4 I believe.

I would like to add support for the newer node-gyp version. Installing node-gyp using Python 3.10.8 was succesfull.

However I am not completely familiar with the npm enviroment. So when testing the driver module this was the error message.

code 1
npm ERR! path /Users/hayer/driver/node_modules/isolated-vm
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild --release -j 4
npm ERR! CXX(target) Release/obj.target/nortti/src/external_copy_nortti.o
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.3.1
npm ERR! gyp info using node@14.21.1 | darwin | x64
npm ERR! gyp info find Python using Python version 3.10.8 found at "/Users/hayer/.pyenv/versions/3.10.8/bin/python3"
npm ERR! gyp info spawn /Users/hayer/.pyenv/versions/3.10.8/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/Users/hayer/driver/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/hayer/driver/node_modules/isolated-vm/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/hayer/driver/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/hayer/Library/Caches/node-gyp/14.21.1/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/Users/hayer/Library/Caches/node-gyp/14.21.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/Users/hayer/driver/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/hayer/Library/Caches/node-gyp/14.21.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/hayer/driver/node_modules/isolated-vm',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build', '--jobs', 4 ]
npm ERR! In file included from ../src/external_copy_nortti.cc:1:
npm ERR! In file included from ../src/external_copy.h:10:
npm ERR! ../src/isolate/util.h:28:75: error: no viable conversion from 'const v8::Local<v8::Context>' to 'v8::Isolate *'
npm ERR!         return Unmaybe(Unmaybe(options->Get(context, v8_string(key)))->ToBoolean(context))->IsTrue();
npm ERR!                                                                                  ^~~~~~~
npm ERR! /Users/hayer/Library/Caches/node-gyp/14.21.1/include/node/v8.h:2848:37: note: passing argument to parameter 'isolate' here
npm ERR!   Local<Boolean> ToBoolean(Isolate* isolate) const;
npm ERR!                                     ^
npm ERR! In file included from ../src/external_copy_nortti.cc:1:
npm ERR! In file included from ../src/external_copy.h:10:
npm ERR! ../src/isolate/util.h:28:9: error: no matching function for call to 'Unmaybe'
npm ERR!         return Unmaybe(Unmaybe(options->Get(context, v8_string(key)))->ToBoolean(context))->IsTrue();
npm ERR!                ^~~~~~~
npm ERR! ../src/isolate/util.h:10:36: note: candidate template ignored: could not match 'MaybeLocal' against 'Local'
npm ERR! template <typename T> v8::Local<T> Unmaybe(v8::MaybeLocal<T> handle);
npm ERR!                                    ^
npm ERR! ../src/isolate/util.h:11:25: note: candidate template ignored: could not match 'Maybe' against 'Local'
npm ERR! template <typename T> T Unmaybe(v8::Maybe<T> handle);
npm ERR!                         ^
npm ERR! 2 errors generated.
npm ERR! make: *** [Release/obj.target/nortti/src/external_copy_nortti.o] Error 1
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/Users/hayer/driver/node_modules/node-gyp/lib/build.js:203:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:285:12)
npm ERR! gyp ERR! System Darwin 22.3.0
npm ERR! gyp ERR! command "/Users/hayer/.local/share/nvm/v14.21.1/bin/node" "/Users/hayer/driver/node_modules/.bin/node-gyp" "rebuild" "--release" "-j" "4"
npm ERR! gyp ERR! cwd /Users/hayer/driver/node_modules/isolated-vm
npm ERR! gyp ERR! node -v v14.21.1
npm ERR! gyp ERR! node-gyp -v v9.3.1
npm ERR! gyp ERR! not ok

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions