Installing NodeJS

Installing NodeJS to be able to run the smart mirror software.


Electron, and thus the magic mirror code, uses a framework called NodeJS.  It’s a framework, or rather an extension of javascript with tons of useful features.

In order to get anything working on my Mac I will have to install NodeJS as well.  You can download it here :

Here you can find 2 buttons.  The left one is the most recent stable version, the right one is the very latest version which may contain some issues.  I installed the stable version (Recommended for must users).

Schermafbeelding 2017-01-04 om 21.17.01.png

It downloads a .pkg file to my downloads folder.   Run it, follow the wizard.  After completion the installer comes with this notice :

Schermafbeelding 2017-01-04 om 21.18.11.png

“node” and “npm” are not folders, they are executables.  They don’t just show up in your applications folder on your Mac.  Let me show you where they are.

Open up a terminal window on your mac and type “ls”.  This is the list command that shows you the content of a folder.  You will see all of the folders of your home folder.  That’s all of the information where your personal documents are saved : documents, images, desktop, music, etc.

That’s not what we want.  Your home folder is actually a folder, somewhere deeper in the folder structure on your drive where there terminal automatically jumps to for your own convenience.  In order to go to the root of your folder structure on your mac type “cd /”.  The “cd” command means “Change Directory”, and it just means browsing to another folder.  The slash sign behind it just denotes that you want the terminal to go to the root folder.

If you type “ls” again you will se a lot of other folders, one of which is “bin”.

type “cd /usr/local/bin/”. You change to the bin directory where “node” and “npm” are installed.
then type “ls” again, and you will see them listed.

“Node” is an executable.  If you type “node” (mind the lower case) you will see that the only thing that happens, is the prompt changing to a “>” sign.  Anything you type here is a javascript command, and pressing enter just executes that command.

Let’s give it a shot.

After the “>” prompt, type

console.log("hello world");

If everything’s alright, you will see the terminal respond with “hello world”.

Schermafbeelding 2017-01-04 om 21.34.13.png

to get out of the “node” command line utility you need to press ctrl+c twice.

The other utility in this folder is called “npm”, which is short for “node package manager”.  NodeJS comes with a lot of additional modules you can install separately.  These modules are contained in packages, and the “npm” tool is responsible for managing those packages.

I’ll be coming back to “npm” in later posts, but for now, just know that there are tons and tons of packages you can download for free.  You can find them on this url :

But you can use the “npm” tool to install them as well if you now the name of the package.  Have fun browsing!







Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s