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

Unable to install fridax because binding.gyp not found - Windwos & Linux #32

Open
lNATl opened this issue Jan 20, 2023 · 1 comment
Open

Comments

@lNATl
Copy link

lNATl commented Jan 20, 2023

Installation prerequisites in windows (10):

  • Microsoft Visual Studio
  • Microsoft Visual Studio Build Tools
  • Desktop development with C++
  • Python Stable Version
  • Nodejs Stable Version
  • node-gyp - Node.js native addon build tool
  • Git

I installed all prerequisites according to their latest version. But after installation I faced many problems. One of the problems I encountered was the following error:

...
gyp: binding.gyp not found (cwd: C:\Users\lnatl\Desktop\fridax) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
...

I found out that these problems are related to node-gyp. So I tried all the solutions available for Windows operating system Like:

  • Downgrading Python to version 2
  • Install Microsoft Build Tools
  • Specifying the MSVS version for NPM
  • Installing the node-gyp several times globally
  • Installing node native modules
  • node-gyp configure and rebuild
  • npm cache clean --force
  • Mandatory introduction of the Python path due to the use of different versions of Python.

And in the end, I reviewed and implemented most of the issues related to this address:
https://github.com/nodejs/node-gyp/issues
The only thing I noticed was that the python version has nothing to do with the gyp node problem. Also, the 2015, 2017 and 2019 versions of Microsoft Visual Studio are better compatible with the node-gyp (according to the experience of people who used the node-gyp).So I decided to install Visual Studio version 2017 (15.9.2) and Visual Studio Build Tools version 2017 (15.9.51). Also, I already had Python version 3.10.5 installed, and since the problem was not with Python, I did not make any changes in the installation of Python with different versions.But the result was still the same.what should i do? After a lot of frustration, I might get better results in Linux. So I installed Ubuntu version 20.04.1 on a virtual machine.


Installation prerequisites in Linux (Ubuntu v20.04):

  • nodejs latest version!
  • node-gyp - Node.js native addon build tool
  • By default, Python is identified with version 3. If for any reason it is not installed, install one of the following versions:
    Python v3.7, v3.8, v3.9, or v3.10
  • A proper C/C++ compiler toolchain, like GCC
  • Build-essential Meta-Package
  • Git

In this environment, I also received the same errors for the following path:

...
gyp: binding.gyp not found (cwd: /home/lnatl/Desktop/fridax) while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
...

Also for the Frida module which was being installed in the node_modules folder:

...
npm ERR! gyp: binding.gyp not found (cwd: /tmp/fridax/node_modules/frida) while trying to load binding.gyp
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
...
@lNATl
Copy link
Author

lNATl commented Jan 20, 2023

For all those who have problems installing this tool, I must say that after a lot of searching and checking installation problems related to node-gyp, I was able to solve the problem in two operating systems.
I decided to make a binding.gyp and tested various cases and after receiving many errors I was able to reach a case that did not have errors.After successive failures, I was really careless about this tool. But I did not give up. I finally found the key to success in this link:
https://githubhelp.com/northwavesecurity/fridax/issues/24
Really?! of course. The only way I hadn't tried was much older versions of NodeJS

Solving the problem in Ubuntu and installing fridax:

  • sudo apt remove gyp (because of conflict with node-gyp)

  • sudo apt remove nodejs

  • sudo apt update

  • curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -

  • sudo apt -y install nodejs

  • node -v
    v14.21.2

  • npm -v
    8.19.3

  • python3 -V
    3.8.10

  • npm install -g node-gyp

  • node-gyp -v
    v9.3.1

  • cd /..PATH../fridax#

  • nano binding.gyp and save this:

{
	"targets": [
		{
			"target_name": "binding",
			"sources": [ "build/Release/binding.node" ]
		}
	]
}
  • node-gyp configure (The result should be error free)
  • node-gyp rebuild --verbose
  • npm install
  • ./fridax.js

=============================================================

Solving the problem in Windows 10 and installing fridax:

  • Be sure to install the prerequisites mentioned above.
  • Completely remove the currently installed NodeJS by utilities. Complete means that even its folders do not remain in the default path.
  • Download Nodejs v14.21.2 from this url:
    https://nodejs.org/en/download/releases/
  • During the installation process, check that the native module installation tick is checked
  • Check versions for python, node and npm
    node -v => v14.21.2
    npm -v => 6.14.17
    python -V => Python 3.10.5
  • npm install -g node-gyp
  • Check version for node-gyp:
    node-gyp -v => v9.3.1
  • Open fridax folder and creat binding.gyp file in root and save this:
{
	"targets": [
		{
			"target_name": "binding",
			"sources": [ "build/Release/binding.node" ]
		}
	]
}
  • Then Run CMD/Powershell as Administrator.
  • node-gyp configure
  • node-gyp rebuild --verbose
  • npm install
  • node ./fridax.js

Everything should work fine. Good luck.

@lNATl lNATl changed the title Unable to install fridax because of binding.gyp not found - Windwos & Linux Unable to install fridax because binding.gyp not found - Windwos & Linux Jan 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant