Execute Command with sudo Node Webkit - node.js

I found this on the npm site and installed it on my machine.
https://www.npmjs.org/package/sudo
but when I installed it and copy/pasted the example code they had, nothing showed up, no errors, no prompt, no output, nothing. Since there is little documentation to go with this I was wondering if anyone has any insight into the correct usage of sudo running on node webkit.

Related

Failing to install Alexa ASK-CLI "request deprecated"

I took a screenshot of the error message(s) I'm getting when trying to install the Alexa ask-cli.
typed in the command in terminal exactly like it says so in the guide
I also have a current version of node.js which is required.
First of all, “request deprecated” is not the reason which causes the failure of installation. Because ask-sdk is using it so you get the warning. you can find more Here
The problem is, the terminal you used did not have necessary permissions to access the /node_modules folder.
If you follow the instructions, are you sure that you ran the terminal with Run as Administrator option (in Windows) or sudo (in Unix)?
or you can try this:
sudo npm install -g --unsafe-perm=true --allow-root
then it should work perfectly

CasperJS from Cygwin

I've just installed node.js, python, casperjs and slimerjs. Not sure if relevant, but I initially used:
npm install capserjs
and
npm install slimerjs
(without the -g flag)
I've since uninstalled both and reinstalled using -g.
When I type "casperjs" from the Windows command prompt, it appears to work fine. However, I prefer to use Cygwin. Typing in "casperjs" from Cygwin yields the following message:
Can't open '/cygdrive/c/[pwd path]/C:\Users[my user]\AppData\Roaming\npm/node_modules/casperjs/bin/bootstrap.js'
...where [pwd path] is whatever directory I happen to be in at the time, and [my user] is my Windows username.
The above suggests it's trying to use $AppData as the root of the path, but for some reason it's also appending the present working directory. When I installed these on another laptop before I tried this one, I didn't experience this problem.
Does anyone know why this might be happening?

npm.cmd closes instantly after few seconds

I'm learning nodeJs. I managed to run nodejs commands on cmd and it works fine. Now I want to install express framework and for that in the tutorial I'm following it asks to type sudo install -g express on npm command prompt. So I typed npm in my windows search, and clicked on it. Right after few seconds less than 3 it closes straight away.
I found that npm.cmd exist in nodejs directory where node.exe found. What could be the problem here. If I were to type the above mentioned command in windows cmd, it says sudo is unrecognized program.SO must I use npm cmd?
After running cmd.exe , I guess you would have node installed but still run node -v , it should respond with the version meaning it's working.
Now if you want to explicitly install express.js you just have to run on, the command prompt itself,
npm install express -g.
Anyways you can follow this link from their official website. Hope it helps. Also sudo is a program for Unix like operating systems, just in case you needed it.

Node cli on Msysgit on WIndows 10

I recently decided to pick up Node on my personal laptop, which I upgraded to Windows 10, and the Node cli seems to hang when I try to run it.
Simply typing node on the console will not initiate the interface, and to do anything else I need to Ctrl+C out of it.
Additionally, running some npm commands take longer than they used to on my laptop. More noticeably, npm init seems to hang after confirming the information to be written to package.json.
Node version is 4.0.0
npm version is 2.14.2
Are there any known issues with Node and npm on Windows 10?
Edit:
After some troubleshooting, I've figured out the error only happens on Msysgit. Neither of the issues happen on the standard command prompt of Windows.
I had the same issue on Windows 7 with Node version 6.11.0 and Msysgit's MINGW64 terminal window.
The problem was caused by the an alias provided by Msysgit as demonstrated below:
$ alias node
alias node='winpty node.exe'
The solution is to run the command:
$ unalias node
Then node will run correctly.
You can add the unalias node command into your .bashrc file in your HOME directory to make this permanent.
Good luck!
Jeff

node.js on Raspberryp]Pi not showing any terminal output

I've installed node.js on my RaspberryPi running Raspbian using
sudo apt-get install nodejs npm
it looks as though it has installed, I got no errors on installation, but when I check the version, I don't get any terminal output from node -v or node --version.
I wrote a simple js file just outputting test to the console, and when I run that from the command line with node index.js, I also don't get any output in the command line.
Is there something I'm doing wrong here? is the Raspbian terminal in some way different from other platforms (I can't imagine it is).
I've also installed following the directions in this post (up to configuring the server) http://blog.rueedlinger.ch/2013/03/raspberry-pi-and-nodejs-basic-setup/ and get the same result, no output in the console
The debian packages for node.js usually don't provide the binary as node (/usr/bin/node) but rather as nodejs (/usr/bin/nodejs) due to possible naming conflict with another binary from another package. (See also http://ypcs.fi/howto/2013/03/23/nodejs-debian/ for example) So you should call nodejs -v etc.
Alternatively/additionally, you can create a symbolic link with ln -s /usr/bin/nodejs /usr/bin/node. Useful expecially if you have to run shell script that expect node to be named node.
I ended up having to re-create my raspbian image (not sure why), and after trying countless different ways of installing node, I ended up using this script https://github.com/midnightcodr/rpi_node_install, it took forever, but it worked in the end.
I've also more recently seen posts which say sudo apt-get install node-js, but didn't try that one myself.

Resources