I'm trying to run the node command in my git bash terminal. When I run the node command, nothing happens when I press enter. The $ goes away and it just leaves a blinking cursor on the next line without the >.
My-PC MINGW32 /
$ node -v
v4.5.0
My-PC MINGW32 /
$ where node
C:\Program Files\nodejs\node.exe
My-PC MINGW32 /
$ node
_
Could someone tell me what the issue could be?
Thanks!!
If you're not getting a new line with a > after entering "node" - this is probably because newer versions of Git Bash don't run in the TTY mode they used to. Discussion here. You can verify by entering:
node -p -e "Boolean(process.stdout.isTTY)"
If that returns false - then the Node REPL (and some other console tools) won't work correctly.
There are a couple workarounds:
Workaround A
winpty node
Or you can add an alias in your .bash_profile:
alias node="winpty node"
# and for npm CLI/scripts:
alias npm="winpty npm.cmd"
Workaround B
Create a new shortcut to Git Bash with the following Target:
"C:\Program Files\Git\git-cmd.exe" --no-cd --command=usr/bin/bash.exe -l -i
and use that instead of the default Git Bash.
Related
I'm running this command from my local machine:
ssh -tt -i "pem.pem" ec2-user#ec2-IPADDRESS.compute-1.amazonaws.com "sudo su -c 'cd /dir/;npm install pm2'"
It connects, operates as a super users, cds to dir and attempts to run the command but returns that npm is not a command recognized by the system.
However, when I connect "manually" i.e.
ssh -i "pem.pem" ec2-user#ec2-IPADDRESS.compute-1.amazonaws.com
sudo su
cd /dir
npm install pm2
it works.
npm is installed under root and the system can see it.
ssh -tt -i "pem.pem" ec2-user#ec2-IPADDRESS.compute-1.amazonaws.com "sudo su -c 'cd /dir/;whoami'"
and
ssh -i "pem.pem" ec2-user#ec2-IPADDRESS.compute-1.amazonaws.com
sudo su
cd /dir
whoami
both return "root"
Why can't the npm command be found when running on top of an ssh?
When you login, you create an interactive shell, which typically will read a couple of files, including /etc/profile, $HOME/.profile, and $HOME/.bashrc in the case of bash.
Any of these files can add extra elements (paths) to the PATH variable, which affects which commands can be found.
When you run the command line directly, no such initialisation takes place, and the value of $PATH may be limited to just /bin:/usr/bin.
Next there is sudo, which may or may not import the value of PATH when looking for commands.
Solution
Best you can do is find out where npm is installed, and use its full PATH.
I am having trouble executing below tmuxinator config. When I run the configuration first letter of second command in panes section is removed. This is happening when I have to execute commands over a ssh session. Same behaviour is observed in executing commands in local but without any errors(first letter of second command is seen missing but gets executed in local).
Here is my sample config file
# /Users/ash/.config/tmuxinator/bst.yml
name: bassh
root: ~/
windows:
- apps:
layout: tiled
panes:
- app1:
- ssh bst
- ssh ash#198.174.145.1
Out put in tmux on running tmuxinator session for bst
~
➜ cd /Users/ash
sh bst
ssh ash#198.174.145.1
~
➜ ssh bst
sh ash#198.174.145.1
[ash#gzp-t2-v-server ~]$ sh ash#198.174.145.1
sh: ash#198.174.145.1: No such file or directory
[ash#gzp-t2-v-server ~]$
below are the versions I am using
➜ tmux -V
tmux 3.1b
➜ tmuxinator version
tmuxinator 2.0.1
➜ zsh --version
zsh 5.7.1
I'm trying to npm install a package in Ubuntu 16.04. I get the following error message:
npm install
...
> padlock#2.0.0-beta.1 bower-install /home/kent/Documents/padlock
> pushd app && bower install && popd app
sh: 1: pushd: not found
My Research
According to /bin/sh: pushd: not found, my problem is clearly that npm install is trying to execute pushd with sh not bash.
However, my default shell is already bash
$ env | grep SHELL
SHELL=/bin/bash
$ echo $SHELL
/bin/bash
$ echo $0
bash
and I'm not sure what I need to change. I've also tried adding SHELL=/bin/bash before I execute pushd app but I have had no luck with that either.
npm-scripts run using sh
Scripts are run by passing the line as a script argument to sh
https://docs.npmjs.com/misc/scripts#exiting
If you want to use bash for your scripts make the script
bash -c 'pushd app && bower install && popd'
Update: As of November 2017 you can now set script-shell in .npmrc to use a custom shell
I was able to work around a similar situation by creating this file in my project directory:
$ cat .npmrc
script-shell=/bin/bash
FWIW, the issue I stumbled upon was relying on bash-specific "curly-brace expansion" commands in the postinstall section of the package.json file for the offending module. That malformed command works in MacOS, but not Linux.
I've installed sublime text from bash but it doesn't work it just return the bash prompt again .
then
I installed sublime natively on windows , problem is I can't run it from bash .
It is already supported in Windows 10 latest build (build 14951), used like this:
$ export PATH=$PATH:/mnt/c/Windows/System32
$ notepad.exe
$ ipconfig.exe | grep IPv4 | cut -d: -f2
$ ls -la | findstr.exe foo.txt
$ cmd.exe /c dir
more information here.
There is a ticket about it in their Github page with some hacks you can use meanwhile.
It appears at this time, the cbwin project is our best bet. I just started running into these same issues with trying to use vagrant from Bash on Windows, and my vagrant install ran into issues that required kernel support (currently lacking in Bash on Windows).
anybody is familiar with the etcd project? Or we'd better forget the project when talk about this issue. The issue is
$ build
ln: `gopath/src/github.com/coreos/etcd': cannot overwrite directory
when exec the build shell
and the content is:
#!/bin/sh -e
if [ ! -h gopath/src/github.com/coreos/etcd ]; then
mkdir -p gopath/src/github.com/coreos/
ln -s ../../../.. gopath/src/github.com/coreos/etcd
fi
export GOBIN=${PWD}/bin
export GOPATH=${PWD}/gopath
export GOFMTPATH="./bench ./config ./discovery ./etcd ./error ./http ./log main.go ./metrics ./mod ./server ./store ./tests"
# Don't surprise user by formatting their codes by stealth
if [ "--fmt" = "$1" ]; then
gofmt -s -w -l $GOFMTPATH
fi
go install github.com/coreos/etcd
go install github.com/coreos/etcd/bench
Some addition:
My system is windows 7
I run the shell on git bash.
issue reproduce:
step1: open the git bash
step2: git clone git#github.com:coreos/etcd.git
step3: cd etcd
step4: build
As mentioned in "Git Bash Shell fails to create symbolic links" (since you are using the script in a git bash on Windows 7)
the ln that shipped with msysGit simply tries to copy its arguments, rather than fiddle with links. This is because links only work (sort of) on NTFS filesystems, and the MSYS team didn't want to reimplement ln.
A workaround is to run mklink from Bash.
This also allows you to create either a Symlink or a Junction.
So 'ln' wouldn't work as expected by default, in the old shell that ships with Git for Windows.
Here's solution. Tbh it is a workaround, but since you're on Windows, I don't see another way.
Start a command line, and enter there to the directory with the script. There should be a path gopath/src/github.com/coreos/ (if no such a path, you must create it). Next issue a command
mklink /D "gopath/src/github.com/coreos/etcd" "../../../../"
Next you should edit the build script to delete a lines with creation symlink and a directory. E.g.
#!/bin/sh -e
export GOBIN=${PWD}/bin
export GOPATH=${PWD}/gopath
export GOFMTPATH="./bench ./config ./discovery ./etcd ./error ./http ./log main.go ./metrics ./mod ./server ./store ./tests"
# Don't surprise user by formatting their codes by stealth
if [ "--fmt" = "$1" ]; then
gofmt -s -w -l $GOFMTPATH
fi
go install github.com/coreos/etcd
go install github.com/coreos/etcd/bench
Note, that I am just removed 4 lines of code. Next you run the script, and this should work.
You shouldn't be using git clone and the build sh script. Use the go get command. For example, on Windows 7,
Microsoft Windows [Version 6.1.7601]
C:\>set gopath
GOPATH=C:\gopath
C:\>go version
go version go1.3 windows/amd64
C:\>go get -v -u github.com/coreos/etcd
github.com/coreos/etcd (download)
github.com/coreos/etcd/third_party/bitbucket.org/kardianos/osext
github.com/coreos/etcd/pkg/strings
github.com/coreos/etcd/error
github.com/coreos/etcd/third_party/github.com/coreos/go-etcd/etcd
github.com/coreos/etcd/http
github.com/coreos/etcd/third_party/github.com/coreos/go-log/log
github.com/coreos/etcd/third_party/github.com/rcrowley/go-metrics
github.com/coreos/etcd/mod/dashboard/resources
github.com/coreos/etcd/log
github.com/coreos/etcd/third_party/github.com/gorilla/context
github.com/coreos/etcd/third_party/github.com/gorilla/mux
github.com/coreos/etcd/mod/dashboard
github.com/coreos/etcd/discovery
github.com/coreos/etcd/pkg/btrfs
github.com/coreos/etcd/pkg/http
github.com/coreos/etcd/third_party/code.google.com/p/gogoprotobuf/proto
github.com/coreos/etcd/mod/leader/v2
github.com/coreos/etcd/mod/lock/v2
github.com/coreos/etcd/metrics
github.com/coreos/etcd/third_party/github.com/mreiferson/go-httpclient
github.com/coreos/etcd/mod
github.com/coreos/etcd/third_party/github.com/BurntSushi/toml
github.com/coreos/etcd/third_party/github.com/goraft/raft/protobuf
github.com/coreos/etcd/third_party/github.com/goraft/raft
github.com/coreos/etcd/store
github.com/coreos/etcd/server/v1
github.com/coreos/etcd/server/v2
github.com/coreos/etcd/store/v2
github.com/coreos/etcd/server
github.com/coreos/etcd/config
github.com/coreos/etcd/etcd
github.com/coreos/etcd
C:\>