BC command not working in CYGWIN - cygwin

I have downloaded CygWin(32-bit) and installed (on Windows 7 32 bit System) today to run shell script but i found one problem that bc command isn't working.
I am getting error -bash: bc: command not found. So please help me out!

On Windows Cygwin, run setup.exe and search for "bc" in the "Math" category, click on it and hit Next to install.
On Unix/Linux you'll probably be needed to install this package Using:
sudo apt install bc

You need to select the bc package for installation from the "Select Packages" window.
By default setup installs only base category that is ~ 50 packages,
while the full availability is ~ 4000.
https://cygwin.com/packages/x86/bc/bc-1.06.95-2

I believe that bc is not installed by default on Cygwin, and you will need to install it manually. This link might help you.
DISCLAIMER: I have never used Cygwin.

Related

sdkman appears to be installed but not showing up on my drive

I have started learning groovy and I just came across the SDKMAN utility.
To give it a try I folllowed the installation guidelines at the official site of sdkman and tried to run the below command to install sdkman on Windows 10 :
set SDKMAN_DIR="E:/sdkman" && curl -s "https://get.sdkman.io" | bash
But I donot see any sdkman folder present in my E drive.
When I try to re-run the command it says :
Looking for a previous installation of SDKMAN...
SDKMAN found.
======================================================================================================
You already have SDKMAN installed.
SDKMAN was found at:
"E:/sdkman"
I am just confused as to why am I not able to see it with my eyes. I have even tried enabling view hidden items.
Tried to execute which sdk. but it clearly says which: no sdk in (..
...
has anyone else experienced similar issue. Any help is highly appreciated.
which bash implementation are you using under windows? cygwin? gitbash?
I believe at least in gitbash that the path syntax is /e/sdkman/, i.e. you would do:
export SDKMAN_DIR="/e/sdkman" && curl -s "https://get.sdkman.io" | bash
but it's been a long time since I was on windows and I suspect this is bash-implementation specific (i.e. it might differ between cygwin and gitbash for example).
If this assumption is correct, the syntax you were using might have created a directory called E:/sdkman under your user's home directory or whatever directory you happened to be in when you ran this. Just guessing here, but worth a look.

Using sudo atom no longer opens Atom at all, let alone as root

I'm using the Atom editor. Yesterday, if I typed:
sudo atom . it opened the current directory as root
sudo atom it opened Atom with whatever I last had open as root
Today if I run either of those commands nothing happens. The editor doesn't open and there are no error messages.
These terminal commands worked yesterday on these exact same files, today they do not.
How can I fix this?
Why is this happening?
If I have not provided enough information it's because I don't know what info one would need to have a fuller explanation of my circumstance. Let me know what I should add I'll happily edit this question to provide it.
Atom : 1.13.0
Electron: 1.3.13
Chrome : 52.0.2743.82
Node : 6.5.0
Ubuntu 14.04 LTS
Elementary OS Freya (64-bit)
After updating Atom text editor it seems I require to run --no-sandbox flag but after a while it becomes boring so I wrote a simple BASH script to be doing this for me:
eval "atom --no-sandbox flag"
just save this in a common directory that you frequently use and type ./atom_text_editor.sh in the terminal to deploy(Depending on the name you choose for your script)
A recommendation, when working on linux avoid using sudo or su instrucctions, they are intended to execute privileged instructions like system configurations. It might be related to permissions, execute ls -al and verify that the owner/group of yor files is root, if not, then check if "others" have read permission, if not, then thats is the problem.
Be aware running atom with sudo is not recommended.
I've had this problem for a few days, I installed atom using snap (on ubuntu 18.04) a few weeks ago, back then it worked perfectly, but the last few days if i ran 'sudo atom' nothing would happen at all, reinstalled it using snap, still didn't work, removed settings, still didn't work.
I ended up installing atom using the apt packagage manager and now it works. I used this guide: https://codeforgeek.com/install-atom-editor-ubuntu-14-04/
Furthermore when running atom with sudo it should be ran with the --no-sandbox flag.
Conclusion: seems to be a problem with atom when installed using snap.

Where can I find node.js interpreter

In WebStorm to get karma.conf running I need to configure it in a pop up window and enter the "path to the node.js interpreter".
(for some reason this information vanished after a restart)
Questions:
What is the path to the needed file?
Where is the node interpreter on Mac/Linux/Windows by default?
(I am on OS X)
Generally, on OSX and Linux, you can find any program with which program. In your case, type
which node
in terminal.
On windows command prompt
where node
On OSX if you've installed Node.js with brew:
/usr/local/bin/node
You can check the exact folder on your machine with the command which node
Important
When the finder opens on OSX, you won't be able to navigate to this path initially. You'll first need to navigate to the root folder e.g. Macintosh HD and then perform the keyboard shortcut Command + Shift + . (. = dot = period) to be able to select hidden files and folders.
Ubuntu:
sudo apt install nodejs
whereis nodejs
nodejs: /usr/bin/nodejs /usr/lib/nodejs /usr/include/nodejs /usr/share/nodejs /usr/share/man/man1/nodejs.1.gz
Configuring NodeJS Intepreter in IntelliJ:
File | Settings | Languages & Frameworks | Node.js and NPM
Node interpreter: Add... (select from the above path or add it)
/usr/bin/nodejs
Then, click on Enable button and select the modules.
On OSX:
/usr/local/bin/node
well I got it by myself, but wanted to share the answer, as I couldn't find it on google / stack overflow and hope to save somebody some time
This can be useful for someone. I tried all the previous methods on Linux Ubuntu 19.10, none worked, neither reinstalling nodejs. So I installed Webstorm via snap, with:
sudo snap install webstorm
sudo snap install webstorm --classic
And surprise, Nodejs was already configured in this version. Then I erased the webstorm version that I installed from Ubuntu Softwared.
That worked for me and was easy. Hope that can give you a clue.

Trouble using QSerialport in Ubuntu

I made a full application in QT creator on my mac (tested and working) and now need to move the source code to my Ubuntu machine and recompile it in QT creator in ubuntu.
This problem is as soon as the project opens I get this error in the "general messages" log
Project ERROR: Unknown module(s) in QT: serialport
So I assumed that QSerialport isn't included in the ubuntu release of QT creator.
I tried to get it myself using these terminal commands I got from a tutorial for installing QSerialport (I don't know linux at all and this is my first time using it).
git clone git://code.qt.io/qt/qtserialport.git
cd qtserialport
git checkout qt5.x.y
This is where i get stuck. I have tried substituting 'x' and 'y' for every number and its returns that no such file can be found.
Have I made some simple mistake? Has anyone out there had to do this?
Try this for your self:
git clone git://code.qt.io/qt/qtserialport.git
mkdir qtserialport-build
cd qtserialport-build
qmake ../qtserialport/qtserialport.pro
sudo make install
Listed in the Ubuntu package repo is the libqt5serialport package, so it should be available but you may need to install the package manually: http://packages.ubuntu.com/trusty/libqt5serialport5
Found the solution:
If anyone else has this problem open "Maintain QT" (which can be found in the installation folder). Select "Add or remove components". In the version of QT you have installed there is a sub-heading called "Source components" and within the "Add ons" category you need to select Qserialport". Then just hit next and install.
Everything worked fine after this.

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