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

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.

Related

Unable to run node from git bash

I am no longer able to run node from the git bash terminal. It works from Git CMD and the standard windows CLI. If I try to run a file (e.g. node index.js) or even just start node via node, I go back to the input prompt except now I can't see any of my character inputs.
This is not a result of PATH not being set, as where node gives me C:\Program Files\nodejs\node.exe and which node gives me /c/Program Files/nodejs/node and echo $PATH does have /c/Program Files/nodejs included.
If I type another command (such as ls), it actually will work even though I will continue to not be able to see my input.
I think this problem arose after the latest Windows 10 OS update was pushed to my system (10.0.17763). I've tried reinstalling Git for Windows and Node, and neither have resolved the issue. I can't find any other settings that might be affecting this.
Using Git CMD or Windows CLI is a workaround, but neither of those have a "Git Bash Here" option, which is the #1 thing I want this for. It is also nice that I get the visual indication of branch in Git Bash where I do not get that with Git CMD or the Windows CLI.
I don't need or want to use Git GUI, and besides that won't allow me to run local node files which I need to do for testing.
Does anyone have any ideas on how I can get Git Bash working with node again?
UPDATE: By running stty -a after node fails, I see that echo has flipped to -echo, which is why I can't see the input anymore. But that doesn't explain why node isn't loading and echo is getting turned off. Hoping that gives someone some additional context to figure out what's going on here. brkint, icrnl, ixon, opost, isig, and icanon are also getting flipped to the - versions after attempting to run node.
There are 2 possible workarounds (based on what your problem is) that I have tried-
Enter node first of all:
1) Try typing in reset and hit enter. You may not be able to see the input logging in, in the bash terminal window, but it works after that.
2) Or try typing any random alphabet and hit enter(again you won't see it on the screen),it will throw a 'command not found' error but you will have node working after this.
I am afraid these aren't exactly proper fixes, but they get the job done.
More information can be found here: https://askubuntu.com/questions/171449/shell-does-not-show-typed-in-commands-reset-works-but-what-happened/172747#172747

Install Git on CentOS 7 LEMP stack

After about 6+ days and numerous rounds of spin-up/destroy I have FINALLY gotten my Digital Ocean droplet server up and running (ie I can view a live page of content at my ip).
At this point I am trying to install Git, and have installed/removed it 3 times so far as I keep getting 'close' to completion but then run into some error I can't find an answer for. I'm hoping someone can help me figure out what my latest problem is so I can move forward with the actual development of my site rathe than spending over a week on the server build.
I have attempted to install version 2.6.2 of git on my server and have had to compile from source (something I am no where near familiar with). I 'thought' I had it correct this time, but received the following error when I attempted to set my git user name:
gitconfig --global user.name "MyUserName" (<--- last command I made)
bash: gitconfig: command not found (<-- error i received)
I thought it was an issue with being in the wrong directory to run the command, so i ran which git and received the following output:
/usr/local/git/bin/git
This seems to be a binary (?) file and none of the directories listed in that path allow me to use gitconfig command either.
Any ideas what I have done wrong? Do I need to remove (again!) and re-compile. I don't desire to be a server admin, but really had thought (hoped?) spinning my own LEMP server on CentOS 7 would be simple - doing so on CentOS 6.* was.
Thanks for your help/advice.
gitconfig isn't a command.
You'd do:
git config --global user.name "MyUserName"
Also you're really better off installing git via yum, rather than compiling from source unless there's a good reason to compile it yourself.
(Edit - updated answer with tested solution on Centos 7).

Jenkins build step fails when calling "npm" on mac-os-x Yosemite

Before I start, I want to say that I already checked these answers:
Jenkins build step fails on 'npm install <whatever>'
Jenkin's build failing on npm install
Now, I'm dealing with this issue for a while already and thus I tried a bunch of stuff.
Firstly, I installed node + npm via homebrew. A simple $ node -v and $ npm -v echoed the version v0.10.36 for node and v2.3.* for npm, which also means I HAVE THEM IN THE PATH and they work while called in the terminal.
Simply adding node -v; npm -v to the execute shell in Jenkins didn't do it. After a bit of tinkering I copied what $: which node yielded in the terminal to the above mentioned script, which now looked like this: /usr/local/bin/node and apparently that worked. The Jenkins build succeeded and 'node-v0.10.36' was proudly displayed in the console output.
When doing the same for 'npm' which happened to be /usr/local/bin/npm --version the computing gods weren't so merciful anymore. A big 'env: node: No such file or directory' error was thrown this time and the whole build failed.
The actual command that fails is
$ /bin/sh -xe /var/folders/wr/g_dl81tn5_x0t_yz3jw602cr0000gn/T/hudson8770480548136671253.sh and "surprisingly" when I run the same command in the terminal it succeeds.
I also uninstalled the homebrew node & npm versions and installed them afterwards via the package manager. Same results.
Ultimately I also did this: https://gist.github.com/DanHerbert/9520689, with no luck.
Notes:
I'm running Jenkins 1.613 and tried with 1.5**
I didn't create a "Jenkins" specific user but instead I'm using the admin. This happens to be the same user that Jenkins runs, since the who am i command inside the executable script yields the admin's user name.
sudo'ing doens't help
I'm also running the whole thing in a Virtual Environment - vagrant
I'm not running Jenkins as a deamon, as it's conflicting with xtools, but as a simple process
I also tried out jenkins-node plugin with various configs (can detail if needed)
Thanks a lot for your help, and let me know if you need any other info, screenshots, logs, etc.
I found my own solution. The problem was that the PATH although visible in shell was not exported for the Jenkins job, and so, the first workaround, as found here, was to export it in the actual script like so:
but this feels like a hack!
The right and elegant solution is to use Jenkins EnvInject Plugin and export the path in the added Properties content textarea on the configuration page, like so:
Manage Jenkins -> Configure System -> Global properties -> Environment variables

how to run npm/grunt command from jenkins

I'm new to this area and was trying to run the following commands from jenkins:
npm install
grunt quickStart
So far I've a jenkins running on a window machine as a window service and I've also installed NodeJs plugin for jenkins.
However, I'm stuck and quit confused following instructions here, its asking me to to add one or mode nodeJs installation and I could not find those setting and not even sure if I even need them in the first place.
Here is the bit that's asking me to do:
I cannot see this setting for the jenkins job I create. Is there an easy way to run those command in jenkins from a .bat or .sh script, a .bat would be recomended since I'm on window machine.
Note : I've already checked out a project using git in jenkins!!!
Thanks
"its asking me to to add one or mode nodeJs installation and I could not find those setting and not even sure if I even need them in the first place."
I don't think you need that I have pointed jenkins to the node installation folder an nothing more.., for this you go to Manage Jenkins->Configure System->NodeJS->NodeJS installations.. type in any name you like and point to where the node home folder is.
...cannot see this setting for the jenkins job I create...
Once you have configure that in your jenkins configuration you should have that configuration available like so:
...Is there an easy way to run those command in jenkins from a .bat or .sh script, a .bat would be recomended since I'm on window machine
I'm sorry don't get what commands are you referring to...
so summarizing :
you have to tell jenkins where you have your node installation
use that configuration in your jobs
hope this helps...
The way I made it, was trough execute shell, as the build tool for nodejs is npm, I simply wrote a shell script that instructs jenkins to run npm install in the workspace directory inside jenkins where it clones the git repository and then to zip and move the package if successful to another folder.

Node.js Cygwin not supported

I am trying to install node.js. I followed this tutorial and i am stuck in the middle.
When I write ./configure in my cygwin terminal it says "cygwin not supported". Please help me out
Thanks in advance.
Node in my experience runs fine in cygwin, what Node usually has EINVAL errors in seems to be MINTTY which is a terminal emulation 'skin' that is default to cygwin. I still am not sure why these EINVAL errors happen 100% but the following are the steps and tricks I use to get node working.
In my /cygwin/home/{username}/.bashrc I add node to path so cygwin can find it
export PATH=$PATH:"/cygdrive/c/Program Files/nodejs/"
If you run a 32 bit version of node:
export PATH=$PATH:"/cygdrive/c/Program Files (x86)/nodejs/"
Then to make npm run without windows to linux issues I launch cygwin in admin mode then run:
dos2unix '/cygdrive/c/Program Files/nodejs/npm'
At this point running files and most npm packages will run in MINTTY just fine, although every once and awhile you will run into EINVAL issues with certain npm packages as karma. Also you will not be able to run the interpreter directly in MINTTY, anytime I want to do these things I run:
cygstart /bin/bash
This will open a native cygwin bash.exe window, from here you run the interpreter or an any troubling package command that results in a EINVAL. It slightly sucks you have to do this but I rarely use this day to day, and I love MINTTY too much to not use it.
Also note that you can run any one line node code in MINTTY by just running something like:
node -e "console.log('hello node')"
As a simpler derivative of troy's answer for those just looking to install NPM packages:
Install Node.js with the Windows installer package.
Add it to the PATH with export PATH=$PATH:"/cygdrive/c/Program Files/nodejs/" (obviously replacing the path to Node.js's installation directory with where you installed it).
There's a current bug in the Windows version that can be fixed by running mkdir -p ~/AppData/Roaming/npm. This is a bug for all of Windows and not just Cygwin. At some point of the future, you won't have to do this anymore, but the command shouldn't have any negative side effects.
Test it. Eg, npm install pretty-diff -g.
In order to be able to run the newly installed software, you'll need to add the install locations to your PATH. You can find these with npm bin -g and npm bin (the -g flag is the "global" installation location).
Not really anything special that you have to do to get it to run in Cygwin (although I can't say if everything works).
Use Console2, it allows you to run create tabs of CLI shells. It seems running cygwin inside console2 allows me to use node REPL just fine. I have no idea why :P
Follow this guide to add cygwin to console2:
http://blog.msbbc.co.uk/2009/11/configuring-console-2-and-bash-with.html
With Bjørn's suggestion (using Console2) and Soyuka's alias (steps here), my node.js v0.10.13 and npm v1.3.2 are now working under Babun v1.02, a Cygwin distribution.
For windows, Just run bash.exe in cmd, so that you could have a bash work around with cmd console directly, which could support ALL NODE WORKING PERFECTLY.
C:\Users\郷>bash
郷#CHIGIX ~
$ node
>
I'm using this wrapper in /usr/local/bin/node (note no extension!)
#!/bin/sh
_cmd="$(cygpath -lw -- "$1" )"
shift
"/proc/cygdrive/C/Program Files/nodejs/node.exe" "$_cmd" "$#"
This is far from perfect, as Node do not understand Cygwin directory tree, but works relatively well with relative names.
From Windows, run Cygwin.bat (instead of Cygwin Terminal) then in that run node: see and reply on this answer on this effectively-same question asked 1.5 years later.
Grab and run the node.js Windows installer.
In the Cygwin prompt type node
See if it works.

Resources