Guiding The Geek In You
Installing nodejs on Mint or Ubuntu is generally a smooth process. Nothing that will bend or break your mind – if you start with a clean slate – and assuming a recent build of Mint or Ubuntu!
Note for the paranoid like me: for the fresh install, we are going to add an “untrusted” PPA (personal package archive). Untrusted simply means that these archives are not overseen by the community at large, so using software from these resources could potentially break your system.
That said, I have used nodejs from Chris Lea’s PPA for months now with zero problems – he does a fantastic job!
Nodejs-dev and npm are included in the nodejs package as of v0.10.0 – another reason to use Chris Lea’s PPA.
Because the latest version of nodejs (or nodejs-dev or the npm) is not available in the default repo, remove any traces before you begin:
sudo apt-get remove nodejs nodejs-dev npm
Install the latest version of nodejs package:
sudo apt-get update
sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
Check that nodejs version v0.10.20 (or better) installed correctly:
nodejs -v
Go ahead and check NPM as well (v1.3.11 or better):
npm -v
Thanks for reading!
Use Gnome? Love gEdit? Me too. In fact I love this little brother to Notepad++ so much that I’ve begun tweaking it into an IDE, and it turns out this little brother is growing up fast.
An important function of any Integrated Development Environment – or IDE – is that it provide a built-in compiler or interpreter. Yet PHP is a server side language so getting it to place nicely outside of a web browser is tricky, but far from impossible.
In fact PHP scripts, like PowerShell or Perl, can be run from the command line. For example to run some_script.php on a machine with PHP installed and configured properly simply open a terminal prompt and type:
php5 directory_name/some_script.php
So how to bridge the gap from CLI to IDE? External Tools.
First, enable the External Tools plugin. Go to the Edit drop down menu, select Preferences, click the Plugins tab, and select the External Tools check box (should be near the top somewhere).
Now, with External Tools selected click the Configure Plugin button to open the External Tools Manager window. Four tools have already been configured for you under “All Languages” – but we’re going to make our own! Find and click the little notepad icon near the bottom left corner of the manager window, which creates a new entry under “All Languages”. Name this entry “Run” (you can change it later).
In the Edit window enter the following code:
#!/bin/sh DIR=$GEDIT_CURRENT_DOCUMENT_DIR FILE=$GEDIT_CURRENT_DOCUMENT_NAME php5 ${DIR}/${FILE}
These BASH commands assign the current PHP script’s directory to DIR and the script’s name to FILE, and then executes the same command we typed above.
In the Shortcut Key field choose a cool key combo to invoke the tool. I like asciitilde (the ~ symbol). In the Save drop down I recommend selecting Current document so your key combo also saves your script before interpreting it.
In the Output drop down pick “Display in bottom pane”, which causes the output of your script to appear statically in a new pane under your code, without appending to your file or opening a new one.
Click on the drop down that reads “All Languages” (by default) and scroll until you find PHP. Choose it, and then hit the Close button.
When you open a PHP script now you need only hit your cool key combination and boom – PHP results sans a web browser!
Hope this helps! Please post below with questions or suggestions.