cannot execute binary file exec format error windows bash - node.js

Am trying to deploy my node express app to heroku from my windows 10 os and am using the git bash terminal, but anytime i try to run the heroku command it returns this error
'/c/Users/user/AppData/Roaming/npm/node_modules/heroku-cli/bin/run:
line 19: /c/Program Files/nodejs/node: cannot execute binary file:
Exec format error'
Please does anyone know how i could solve this challenge?
PS: i ran the command as administrator on git bash

From heroku-cli GitHub repository I can see the following 19th line of the run file:
node "$DIR/run.js" "$#"
Looks like it tries to run run.js file but fails because can't recognise node as an executable binary file.
It's possible that you have a NodeJS version with wrong architecture or installation was not successful. Anyway seems like node is not installed correctly.
So I would uninstall it properly and install it again regarding architecture of the OS

Related

Using Wine in Heroku

Can anybody help me figure out how do I use Wine in Heroku?
I deployed Wine to Heroku with the button in the readme of https://github.com/TheBotlyNoob/heroku-buildpack-wine.
But when I tried to run Wine like this:
It didn't work. Am I trying to run Wine wrong? Or is there another step I need to do?
Thanks.
I've installed both versions of wine (stable and release) but when I try to execute the command on the bash the shell answer that the file doesn't exist:
bash: /app/vendor/wine/bin/wine: No such file or directory
Heroku bash: wine not such file
Even if wine is installed and the file is executable:
wine
If you try to launch notepad the answer of the bash is the same:
/app/vendor/wine/bin/notepad: 46: exec: /app/vendor/wine/bin/wine: not found
even if wine is in the PATH.
Conclusion: wine doesn't execute.
A way to have wine on Heroku is to download the package from ubuntu with his dependencies, put them in the repository and install it.
Hope it was useful.

RethinkDB 2.4.1 windows build

I'm trying to build the rethinkdb in windows using cygwin. Config runs ok, but making the v8 depedency fails. Anybody more lucky?
Error: open /cygdrive/c/rtdb/rethinkdb-2.4.1/external/v8_4.7.80.23.fetch-wINBkpwO/depot_tools/cipd_client_version: The system cannot find the path specified..
Bootstrap from scratch failed, something is seriously broken. Run the following commands to diagnose if this is repeating:
export CIPD_HTTP_USER_AGENT_PREFIX=depot_tools/364205c70ed16c00802b1c264e88d8e03a0b37ae/manual
/cygdrive/c/rtdb/rethinkdb-2.4.1/external/v8_4.7.80.23.fetch-wINBkpwO/depot_tools/.cipd_client selfupdate -version-file /cygdrive/c/rtdb/rethinkdb-2.4.1/external/v8_4.7.80.23.fetch-wINBkpwO/depot_tools/cipd_client_version
/cygdrive/c/rtdb/rethinkdb-2.4.1/external/v8_4.7.80.23.fetch-wINBkpwO/depot_tools/bootstrap_python3: line 32: bootstrap-3.8.0.chromium.8_bin/python3/bin/python3: No such file or directory
'ygdrive' is not recognized as an internal or external command,
Blockquote

How to create git hooks in Windows with Node.js?

I have been following this guide on how to use Node.js to script git hooks. However, the guide is using a Unix based system whilst I am running on a Windows machine.
I have also found this guide on running git hooks on a Windows machine, but it is not using Node.js
I am running a pre-install script in my package.json file to set a custom git hooks location.
I am using VSCode as my editor and would like the git hooks to run when I use the UI for commits etc. However I am using command line initially to try and get the hooks to fire.
package.json excerpt
"scripts": {
"preinstall": "git config core.hooksPath ./git.hooks"
},
In my git.hooks folder I have a pre-commit.js file.
I have updated the first line to reflect the fact I'd like to execute the script running Node.js
pre-commit.js
#!C:/Program\ Files/nodejs/node.exe
console.log('Hello world!');
process.exit(1);
If I run this script directly I get a Microsoft JScript compilation error - Invalid character on line 1 char 1.
If I do a commit, I get no errors but nothing happens.
Can anyone guide me through the process of creating a Node.js hook in Windows. I would rather create one myself than use a package.
Name the hook exactly pre-commit, without .js.
Change the first line to #!/usr/bin/env node. But make sure that C:/Program\ Files/nodejs/node.exe has been added to the environment variable PATH.
Place it in <repo>/.git/hooks.
Make it executable. In git-bash, run chmod a+x <repo>/.git/hooks/pre-commit.
Now it should work as expected.

Convector env:restart throws cryptogen: cannot execute binary file

Running npm run env:restart results in the following error:
...
[hurley] - Running cryptoconfigsh
/bin/bash: line 25: /Users/ecairol/hyperledger-fabric-network/fabric-binaries/1.3.0/bin/cryptogen: cannot execute binary file
[hurley] - Found error while running script!
I have tried installing from scratch two projects with the same result.
Node version: v8.12.0
waltermontes Today at 10:46 PM
Looks like the binary files are not compatible for your OS version,
that usually happens when you run hurley inside of a Docker or
something like that.
Remove the folder
/Users/username/hyperledger-fabric-network and try again, everything
should be downloaded again fine

Can't run heroku or vagrant in cygwin, but OK in cmd

Somehow, I can't run vagrant or heroku in cygwin. It works fine when I'm using the default windows cmd application, but in cygwin, I get this error for vagrant:
C:/vagrant/vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in to_specs': Could not find vagrant (>= 0) amongst [] (Gem::LoadError) from C:/vagrant/vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:into_spec' from C:/vagrant/vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in gem' from C:/vagrant/vagrant/embedded/gems/bin/vagrant:22:in'
And for heroku:
C:\Program Files (x86)\ruby-1.9.2\bin\ruby.exe: No such file or directory -- /cygdrive/c/Program Files (x86)/Heroku/bin/heroku (LoadError)
What is this thing about ruby? I have no idea what I should be doing - developing in windows is a real pain, can anyone provide any insight into how I might solve this problem?
Appreciate any help. Thanks!
I ran in the same problem using Rails and Heroku on Windows.
It seems that the Toolbelt is not supported under Cygwin. Moreover colors are not always rendered in the right way (for example, I did not manage to render heroku logs colors, even after using ansicon -i).
I also considered using the CMD Prompt augmented with GOW but that means you have to append ".bat" to every command, and colors are still a problem.
I ended up using the Git Bash shell that is included with the RailsInstaller package.
It recongnizes all paths to relevant files, it has all the shell commands you need, and every color seems to be rendered correctly (e.g. rails logs, cucumber and rspec tests, heroku logs, etc.).
You've probably solved your issue a long time ago but I just wanted to add the steps I went through as I had the same issue on Windows with Cygwin.
Firstly always try to do an update of your Cygwin installation especially when you see an error similar to the one you've posted (I had the same error):
/ruby: No such file or directoryin/heroku: line 4: /cygdrive/d/Development/Heroku/ruby-1.9.2/bin
So I updated Cygwin and made sure to select all necessary ruby packages/interpreters etc, but this still didn't solve the problem as I kept getting the same error message.
Then I followed the steps outlined in Running the Heroku Command-Line Client Under Cygwin:
(1) Download RubyGem 1.9.3 from
http://rubyforge.org/frs/download.php/76072/rubygems-1.8.24.zip
(2) Then run the following -
$ unzip rubygems-1.8.24.zip
$ cd rubygems-1.8.24/rubygems-1.8.24
$ ruby setup.rb install
$ gem update --system
$ gem install heroku
(3) Open a new shell window and verify the version -
$ heroku version
heroku-gem/2.28.10 (i386-cygwin) ruby/1.8.7
This solved my problem and I can now run heroku commands from the Cygwin shell on Windows.
For me #Azkuma's answer only got me half the way. What worked for me:
1) Download and extract RubyGem zip: https://rubygems.org/pages/download
2) Set aliases to gem and heroku
alias gem='C:/ruby/bin/gem'
alias heroku='"C:/Program Files (x86)/Heroku/bin/heroku.bat"'
3) install as above
ruby setup.rb install
gem update --system
gem install heroku
4) login to heroku
heroku login
I found simply setting an alias worked for me.
alias heroku=c:/Program\\\ Files\\\ \\\(x86\\\)/Heroku/bin/heroku.bat
Then I can just use the heroku command directly with Cygwin.
The only thing I have a problem with is heroku login (and by extension, git push heroku master) whereby I'm prompted to use cmd.exe. For that part, I just open my Git Bash window from within the relevant folder, login and push from there.

Resources