MEAN.io on Ubuntu 14.04

14 October 2014

I recently tried to get MEAN running on Ubuntu 14.04 and I ran into problems. Here are the issues that I ran into, what I did wrong to respond to the errors, and how you can easily resolve the problems.

The MEAN site gives the following "2 minute" installation process instructions. For me at least, they completely failed.

$ sudo npm install -g [email protected] $ mean init myApp $ cd myApp $ npm install $ grunt

Starting with the first line (installing MEAN), there was an error. To resolve this, all I had to do was update npm and retry.

$ npm update npm -g $ sudo npm install -g [email protected]

Initializing the application and moving into the folder was no problem. But, when I went to install the dependencies, I got another error.

$ mean init myapp $ cd myapp $ npm install Error: Attempt to unlock [email protected], which hasn't been locked at unlock (~/Documents/myapp/node_modules/npm/lib/cache.js:1304:11) at cb (~/Documents/myapp/node_modules/npm/lib/cache.js:646:5) at ~/Documents/myapp/node_modules/npm/lib/cache.js:655:20 at ~/Documents/myapp/node_modules/npm/lib/cache.js:1290:7

When something is locked or there is a permissions error and I feel that it is safe to do so, I try using sudo. Doing so appeared to work. But, when I ran grunt, it was still not working.

$ sudo npm install $ grunt GET / 304 35.867 ms - - events.js:72 throw er; // Unhandled 'error' event ^

I later found out that bower has an issue when running as root. So, I could not run it under sudo and I was back to the "Attempt to unlock" error.

This time, I tried to delete my folder and try again using the advice in this post. But, it too failed.

In the end, it turned out to be that the folder simply did not exist and bower was not creating it.

Conclusions

Use the following commands when installing MEAN on Ubuntu 14.04 and starting a new project.

sudo npm install -g [email protected] mean init myApp cd myApp mkdir node_modules npm install grunt