I'm trying to install the brain.js
module through NPM, but it always throws these errors:
npm ERR! code 1
npm ERR! path /var/www/ai/node_modules/gl
npm ERR! command failed
npm ERR! command sh -c prebuild-install || node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@12.22.9 | linux | x64
npm ERR! gyp info find Python using Python version 3.10.4 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/var/www/ai/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 '/var/www/ai/node_modules/gl/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/var/www/ai/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/user/.cache/node-gyp/12.22.9/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=/home/user/.cache/node-gyp/12.22.9',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/var/www/ai/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/home/user/.cache/node-gyp/12.22.9/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/var/www/ai/node_modules/gl',
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! /bin/sh: 1: python: not found
npm ERR! gyp: Call to 'python commit_id.py check ..' returned exit status 127 while in angle/src/angle.gyp. while loading dependencies of binding.gyp while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/var/www/ai/node_modules/node-gyp/lib/configure.js:351:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (events.js:314:20)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
npm ERR! gyp ERR! System Linux 5.15.0-52-generic
npm ERR! gyp ERR! command "/usr/bin/node" "/var/www/ai/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /var/www/ai/node_modules/gl
npm ERR! gyp ERR! node -v v12.22.9
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
This is on a fresh install of Ubuntu 22.04. Is this an issue with Python? I've already installed Python 3 and Python 2.7 (the command python
is an alias to python2
), and yet it still doesn't work. Could somebody please help me out with this?