Installing node, npm and express on MacOS X

Installing node, npm and express on MacOS X

I’ve recently done a lot of work with Nodejs and thought I give a short installation guide on getting up and running on the Mac since there seems some confusion how to install it.

In this guide I’m using Homebrew since this is seriously the best and easiest way to install software for the Mac. Homebrew pulls downs its updates from a global repository and keeps all packages up-to-date. In the many years I’ve used Homebrew I hardly ever had any issues with it.

To install Homebrew use this (in the terminal):

[code]ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"[/code]

Once installed, you can simply install Nodejs with:

[code]brew install node[/code]

This install node and also adds it to your path. Thus you can simply issue “node” in the terminal. Now, in order to do some serious development with Nodejs you will also want to install NPM (which stands for Node Packaged Modules) which allows you to expand Node with, e.g. Express and many other useful packages.

Luckily, installing npm is as easy as;

[code]brew install npm[/code]

With npm installed you can now install Express. Express is the web application framework written for Nodejs. Since Express is for Nodejs we can now use npm to install express into our application. But before doing so, you should understand the difference between *global* and *local* modules.

With every Nodejs application you can install modules for the application only or install them globally, so they are available to all applications. Local modules are installed in the “node_modules” within your application folder whereas global modules will be installed in a global “node_modules” folder (within the path of nodejs itself).

In order to install a module globally you simply append the “-g” flag to your install statement. In short, for installing express globally you would do:

[code]npm install express -g[/code]

If you want to install express locally to the application you first would change to the application directory and then issue a:

[code]npm install express[/code]

As mentioned, this will create a “node_modules” folder (if not already there) and place the express module in it.

There you go. In short steps you just set up a complete web development environment.

Helpmonks All-in-one Customer Service Platform
Switching from brew to nvm for node install

Many people use a simple "brew install node" to get node running on their machines. However, today I discovered that all global node modules could not be updated properly. I got errors like: [code]npm ERR! error rolling back Error: Refusing to delete: /usr/local/bin/npm not in /usr/local/lib/node_modules/npm npm ERR! error rolling…

Helpmonks All-in-one Customer Service Platform
Python wxPython install on MacOS X 10.8.x

wxPython is a GUI library kit for developing desktop application with Python. Since it is cross-platform you can actually run your code on MacOS X, Windows and Linux. Now, while installing wxPython on my development environment (MacBook Air 13", MacOS X 10.8.x) and the standard installer from the wxPython website I've…

Helpmonks All-in-one Customer Service Platform
How to create a virtual machine server image from a physical CentOS server

I run a couple of servers over at a server farm. All of those machines run VMWare ESX, so today I wanted to move my last physical server to a VMWare image. If you want to convert a physical Windows machine then your task is quite easy. Start up the…

Helpmonks All-in-one Customer Service Platform
Fix for running MySQL 5.5.8 under MacOS X 10.6.5 (Snow Leopard)

Oracle recently released the latest MySQL 5.5.x versions. Despite of having tones of fixes and supposedly running much faster and (finally) making InnoDB the default storage engine, it is always good to keep up to date with latest releases. But, as in the past, MaxOS X users always have to…

The system is running in low-graphics mode
Linux and "The system is running in low-graphics mode" error

So, after moving from Mac to Windows to Linux, I went on a crusade to find the perfect Linux Desktop Environment. I originally installed Ubuntu 15.04 and quickly wondered off to Cinnamon, tried, Gnome 2 and 3, then XFCE and tried Tiling Managers like AwesomeWM and i3. Without starting a desktop…

Helpmonks All-in-one Customer Service Platform
MacOS X: Uninstall Java 7 and restore Java 6 (from Apple)

Since many people come to this blog looking for a solution to install Java 7 on MacOS X, it is kind off natural to also show how to uninstall Java 7 and restore Java 6 from Apple. Actually, all these informations are also available over at this page, this page,…

Trusted by over 2,000 organizations with millions of emails

Helpmonks helps us answer customer emails at lighting speed
We couldn't do our job without Helpmonks!
Helpmonks, the best thing since sliced bread
Excellent option for collaborating email amongst your team
A good platform that is here to grow and help you grow
Helpmonks is a great tool that our company utilizes and depends on
Great shared inbox for the team
Fantastic email support service for any business
Easy to navigate and catalog data for specific users
Solid Helpdesk software w/ responsive customer support
A really good solution to manage customer support mailbox
Good support, useful features

One more thing...

Helpmonks gives you the ability tocollaborate as a groupin your shared mailbox, features aTeam To-Do App, powerfulCustomer Relationship Management (CRM)capabilities, a completeLive-Chat tool, a mighty Email Marketing Platform that includes sending ofemail campaignsandemail automation, collision detection, email tracking, reminders, mentions, custom fields, custom applications, customer satisfaction ratings, Single-Sign-On (SSO) & SAML authentication, Trello, Zapier, Slack, an API, and much more.

Check outthe complete feature listor sign up for afree 30-day shared inbox trial now