Open kul-sudo opened 11 months ago
I also have noticed that many people have created similar issues, but none of them has got a clear solution that works.
Your error message - Error: Cannot find module 'gpu.js' - means you have to also do npm install gpu.js
Your error message - Error: Cannot find module 'gpu.js' - means you have to also do
npm install gpu.js
I wish it was as simple as that.
It shows the following error when I do yarn add gpu.js
:
error /home/user/Documents/chessy/node_modules/gl: Command failed.
Exit code: 1
Command: prebuild-install || node-gyp rebuild
Arguments:
Directory: /home/user/Documents/chessy/node_modules/gl
Output:
prebuild-install warn install No prebuilt binaries found (target=20.5.0 runtime=node arch=x64 libc= platform=linux)
gyp info it worked if it ends with ok
gyp info using node-gyp@9.4.0
gyp info using node@20.5.0 | linux | x64
gyp info find Python using Python version 3.10.6 found at "/usr/bin/python3"
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args '/home/user/Documents/chessy/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 '/home/user/Documents/chessy/node_modules/gl/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/user/Documents/chessy/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/user/.cache/node-gyp/20.5.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=/home/user/.cache/node-gyp/20.5.0',
gyp info spawn args '-Dnode_gyp_dir=/home/user/Documents/chessy/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/home/user/.cache/node-gyp/20.5.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/home/user/Documents/chessy/node_modules/gl',
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 ]
/bin/sh: 1: python: not found
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
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/home/user/Documents/chessy/node_modules/node-gyp/lib/configure.js:325:16)
gyp ERR! stack at ChildProcess.emit (node:events:514:28)
gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12)
gyp ERR! System Linux 6.2.6-76060206-generic
gyp ERR! command "/home/linuxbrew/.linuxbrew/Cellar/node/20.5.0/bin/node" "/home/user/Documents/chessy/node_modules/gl/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /home/user/Documents/chessy/node_modules/gl
gyp ERR! node -v v20.5.0
gyp ERR! node-gyp -v v9.4.0
gyp ERR! not ok
Looks like gyp
finds python (as python3
) but your shell doesn't.
For kicks, can you share the output of running simply python --version
and python3 --version
in bash respectively?
I think a simple solution, if only the latter works, would be to alias python3
to python
by adding this line to your .bashrc
profile:
alias python=python3
You can simply run the above in your shell and try installing again, but the change will be for the duration of that session. If you want to persist it by adding it to your bash profile, you'll also need to run source ~/.bashrc
after the addition, or just create a new session.
Let us know how it goes!
You might need python-is-python3
:
Or better yet create a venv with python3 -m venv .venv && source .venv/bin/activate
@cclauss 's recommendation is also a good one and essentially does the same thing I described, as a system-wide package
sudo apt-get install python-is-python3
Some light reading on what this package does and possible drawbacks/considerations.
Looks like
gyp
finds python (aspython3
) but your shell doesn't.For kicks, can you share the output of running simply
python --version
andpython3 --version
in bash respectively?I think a simple solution, if only the latter works, would be to alias
python3
topython
by adding this line to your.bashrc
profile:alias python=python3
You can simply run the above in your shell and try installing again, but the change will be for the duration of that session. If you want to persist it by adding it to your bash profile, you'll also need to run
source ~/.bashrc
after the addition, or just create a new session.Let us know how it goes!
I used Homebrew to install Python and have already set the alias like that, but still get the error when trying to install GPU.js that it wants me to install.
@cclauss 's recommendation is also a good one and essentially does the same thing I described, as a system-wide package
sudo apt-get install python-is-python3
Some light reading on what this package does and possible drawbacks/considerations.
I remember I have already tried this package, but still got the error. Also, the alias command is the same as installing this package, isn't it?
You might need
python-is-python3
:
- https://launchpad.net/ubuntu/lunar/+package/python-is-python3
- https://packages.debian.org/bookworm/python-is-python3
Or better yet create a venv with
python3 -m venv .venv && source .venv/bin/activate
Will it work when I deploy my Next.js project with Brain.js to Vercel?
Yes.
EDIT: Yes, for Python venv.
Yes.
I have set an alias, but still get the following error when doing yarn add gpu.js
:
error /home/user/Documents/chessy/node_modules/gl: Command failed.
Exit code: 1
Command: prebuild-install || node-gyp rebuild
Arguments:
Directory: /home/user/Documents/chessy/node_modules/gl
Output:
prebuild-install warn install No prebuilt binaries found (target=20.5.0 runtime=node arch=x64 libc= platform=linux)
gyp info it worked if it ends with ok
gyp info using node-gyp@9.4.0
gyp info using node@20.5.0 | linux | x64
gyp info find Python using Python version 3.11.4 found at "/home/linuxbrew/.linuxbrew/opt/python@3.11/bin/python3.11"
gyp info spawn /home/linuxbrew/.linuxbrew/opt/python@3.11/bin/python3.11
gyp info spawn args [
gyp info spawn args '/home/user/Documents/chessy/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 '/home/user/Documents/chessy/node_modules/gl/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/user/Documents/chessy/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/user/.cache/node-gyp/20.5.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=/home/user/.cache/node-gyp/20.5.0',
gyp info spawn args '-Dnode_gyp_dir=/home/user/Documents/chessy/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/home/user/.cache/node-gyp/20.5.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/home/user/Documents/chessy/node_modules/gl',
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 ]
/bin/sh: 1: python: not found
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
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/home/user/Documents/chessy/node_modules/node-gyp/lib/configure.js:325:16)
gyp ERR! stack at ChildProcess.emit (node:events:514:28)
gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12)
gyp ERR! System Linux 6.2.6-76060206-generic
gyp ERR! command "/home/linuxbrew/.linuxbrew/Cellar/node/20.5.0/bin/node" "/home/user/Documents/chessy/node_modules/gl/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /home/user/Documents/chessy/node_modules/gl
gyp ERR! node -v v20.5.0
gyp ERR! node-gyp -v v9.4.0
gyp ERR! not ok
@cclauss also, thanks for the pull request. I'll check it out. https://github.com/BrainJS/brain.js/pull/905
My "Yes" was for Python venv.
Yes.
I have set an alias, but still get the following error when doing
yarn add gpu.js
:error /home/user/Documents/chessy/node_modules/gl: Command failed. Exit code: 1 Command: prebuild-install || node-gyp rebuild Arguments: Directory: /home/user/Documents/chessy/node_modules/gl Output: prebuild-install warn install No prebuilt binaries found (target=20.5.0 runtime=node arch=x64 libc= platform=linux) gyp info it worked if it ends with ok gyp info using node-gyp@9.4.0 gyp info using node@20.5.0 | linux | x64 gyp info find Python using Python version 3.11.4 found at "/home/linuxbrew/.linuxbrew/opt/python@3.11/bin/python3.11" gyp info spawn /home/linuxbrew/.linuxbrew/opt/python@3.11/bin/python3.11 gyp info spawn args [ gyp info spawn args '/home/user/Documents/chessy/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 '/home/user/Documents/chessy/node_modules/gl/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/home/user/Documents/chessy/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/home/user/.cache/node-gyp/20.5.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=/home/user/.cache/node-gyp/20.5.0', gyp info spawn args '-Dnode_gyp_dir=/home/user/Documents/chessy/node_modules/node-gyp', gyp info spawn args '-Dnode_lib_file=/home/user/.cache/node-gyp/20.5.0/<(target_arch)/node.lib', gyp info spawn args '-Dmodule_root_dir=/home/user/Documents/chessy/node_modules/gl', 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 ] /bin/sh: 1: python: not found 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 gyp ERR! configure error gyp ERR! stack Error: `gyp` failed with exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (/home/user/Documents/chessy/node_modules/node-gyp/lib/configure.js:325:16) gyp ERR! stack at ChildProcess.emit (node:events:514:28) gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12) gyp ERR! System Linux 6.2.6-76060206-generic gyp ERR! command "/home/linuxbrew/.linuxbrew/Cellar/node/20.5.0/bin/node" "/home/user/Documents/chessy/node_modules/gl/node_modules/.bin/node-gyp" "rebuild" gyp ERR! cwd /home/user/Documents/chessy/node_modules/gl gyp ERR! node -v v20.5.0 gyp ERR! node-gyp -v v9.4.0 gyp ERR! not ok
Both python3 --version
and python --version
log the same version, but I still have the error. I actually at the moment am a bit confused.
Keep in mind, it is all Next.js.
What are the results of python3 --version
?
What are the contents of binding.gyp
?
Oh... stackgl/headless-gl#221
What are the results of
python3 --version
? What are the contents ofbinding.gyp
?Oh... stackgl/headless-gl#221
The "Oh..." has made me oddly satisfied. So I need to install Python 2, don't I? This is what is apparently said in the thread.
python3 --version
: Python 3.11.4
Where can I find binding.gyp
?
Sorry for sending several messages instead of sending one with everything, but I think I have found a temporary solution which is to install an older version of gpu.js
, to wit, 1.10.4, but it must not be the final solution.
Hope what you have done will contribute to this problem getting finally fixed.
Had the same as initial post's stack-trace during install on Mac OS Ventura using python from brew, fixed with:
cd /opt/homebrew/bin
sudo ln -sf python3 python
@romaleev bad idea but hey, it is your machine.
What is wrong?
When I run
npm i brain.js
in the folder of my project, I get the following error:Whenever I try to sort of omit this error and do
yarn add brain.js
, I run the app and get the messageError: Cannot find module 'gpu.js'
.I use Brain.js in Next.js.
Version information
Nodejs:
v20.5.0
Browser:
Google Chrome
Brain.js:
Unable to install, but mean to install the latest version possible.
How important is this (1-5)?
It, I think, is 5, because I cannot install the library from the very get-go.
Other Comments
I never have this error on Windows.