node.js help for creating a silent doorbell - node.js

I'm not a coder (just wanted to get that out there). I read an article about creating a silent doorbell (I have a dog that's insane).
https://github.com/initialstate/silent-doorbell/wiki/Part-2.-Finding-the-Button's-Address
I'm relatively computer literate. I followed the instructions for windows and download node.js. The instructions say to open a node.js command prompt and put in the following command:
sudo apt-get install npm
sudo apt-get install libpcap-dev
npm install node-dash-button
the problem i'm having is 1) I'm getting an error saying "apt-get" is not recognized as an internal or external command operable program or batch file.
Reiterating that I am no nowhere near as sophisticated as the users i've seen on here and am just a guy trying to keep the baby sleeping b/c the dog can't shut up - is anyone able to help so I can then go to the next step of instructions?
Thanks so much in advance.
Brad

sudo apt-get is a linux packet manage, so you wouldn't want to do this on windows. As they have mentioned raspberry-pi's I gather that they have made the assumption that you would be on linux.
If you ran that command in a linux terminal it would install the preqequisites and then install node-dash-button in node.
Try just running the nodejs packet manager part:
npm install node-dash-button
The rest of that line is not node or windows.
Hopefully this will get you to the next stage :)

The whole tutorial asumes you being on a Linux/Unix system.
If you solve this issue you will run into the next if you don't know what the commands mean and how to translate them to windows.
For example
sudo node bin/findbutton
is a linux/unix command as well (which is the next step in your tutorial).
So i strongly suggest setting up a VM with linux (debian should do).

Related

Error building a script for linux

I'm trying to build a script for linux to help me each time I install linux from scratch.
The Script have to 1.- Add repositories 2.- Install software from those repositories.
Adding repositories are not the problem, the problem is when i try to install software from this repo.
For the Repo:
sudo add-apt-repository -y ppa:webupd8team/java
After that, the script should make an update, so:
sudo apt-get update
It looks simple, but is not, because I receive an error:
The command Update could not be found.
And so on the rest of the softwares
apt-get -y install oracle-java8-installer
The package oracle-java8-installer couldn't be found..
I really don't know what should I do, nothing looks to work, I gave full rigths to the file and so on... always the same error.
But if I run the command apt-get install direct from the terminal, works without problem..
Any help?
actually I wrote a script in windows to use it in future Linux installations, for some reasons it doesn't work as I want it. Thinking it was a command or misspelled words, I search for a solution, wich didn't help anyways.
Debugging my script in a virtual Machine, I found that the script was giving some random errors like '/r' doesn't support and like that. Really weird because after searching in my script for that line code I didn't find it.
With that in mind, I search again for those errors, and found that for some reasons, if you write your code in a Windows maschine, it save it in a crlf type, wich in a Linux system is interpreted really wrong.
A solution of some users was converting the type from CRLF to LF, wich in linux is using the command dos2unix.
dos2unix filename.sh
After making that and runing my script again everything works perfectly.

How to execute a .run file using Mac Terminal?

Once I navigate to a certain directory that has a .run file in it, how do I execute that file using mac Terminal?
I have change the chmod 777 for fileName.run file and run it
$ chmod 777 file-name.run
$ ./file-name.run
but it does not work for me. any idea ?
it give me the following error.
$ ./ppasmeta-9.4.1.3-linux-x64.run: cannot execute binary file
Its postgres plus advanced server for linux I want to install on mac os-x .
As suggested by Muhammad Iqbal, you won't be able to run a Linux-specific binary/executable on Mac OS X without some modifications. It's like attempting to run an .exe on Linux - without wine. While Linux and OS X are similar, they are not that compatible. If you can get your desired program in the form of a .deb, that may work. If not, I would suggest either dual-booting your Mac with a small Linux distro (ie. DSL) or picking up a virtual machine. I've dual-booted before - it's a decent option for this situation if you have enough hard drive space. If another solution shows up, I'll be sure to let you know through this channel.
I am not sure what you are asking here but try this
./run
As I said in the comments, I don't think that Postgres Advanced Server is available for OSX. If Postgres 9.5.3 is suitable for your purposes, you could install homebrew and use it to install Postgres 9.5.3 with:
brew install postgresql
You can download the one-liner to install homebrew from here.

Can't run NodeSchool workshops in Git Bash. "TypeError: process.stdin.setRawMode is not a function"

From the research I did for the topic, I saw some recommendations to install tty.js with npm, but it wouldn't install as well - some sort of python exe missing from the system error.
I am able to run the program from Git CMD but it is all confusing for me because I am familiar with unix based consoles :(
The way I installed node.js and npm : All was doen with the installer provided by node.js.
Any insights? Thank you in advance!
I have installed tty.js in a linux enviroment and it works great, you should some building essentials installed, such as:
gcc
g++
make
As well as Python 2.7. When installing using npm, it will look for all the dependencies and as I understand it will compile some C code that does the magic behind the scenes. I haven't tried it on Windows, but what I have seen there is the C code designed for windows, so it probably will run.
Maybe I will be of more help if you copy what you get on the npm installation.
have you tried using Git Bash? That is what I used for the most part as well and acts more unix like. If you're on a PC, an alternative is using ConEMU as they give you a shell that is unix like. Just wanted to give you some options if you're still running into trouble, I know this is super late :)

/usr/bin/time: No such file or directory

I'm trying to run the time command for a file on a virtual machine running Fedora 19 64-bit and I get the message "/usr/bin/time: No such file or directory". I tried googling, but it appears it's something that I should already have. How do I get this on my computer?
For those on a raspberry pi or similar debian-based distributions, I found that I could install the package time (sudo apt install time) to obtain access to the time command.
Edit: For Fedora-based systems, the package name might be different. Try a dnf search time, followed by a sudo dnf install {package_name}. I don't have a Fedora machine immediately to hand to get the exact package name from.
bash/zsh/modern shells usually implement a basic time command as a builtin. So it won't exist on the filesystem, but time mycommand should work.
If you want the "proper" time command (with more options eg: -l/-v), then you'll need to install it via apt/yum/etc. You'll need to run it as /usr/bin/time mycommand so the shell-builtin doesn't get invoked.
It might be in other locations. I'd start by typing:
which time
This command will give you the path to time, if it's anywhere in your path.
If you need to build it yourself, you can get the source here:
http://directory.fsf.org/wiki/Time

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