Ubuntu 16.04 mean.js installation (without using one click app)

June 17, 2017 144 views
MEAN Node.js Ubuntu 16.04

I am trying to install mean.js on my ubuntu 16.04 using the following guide. And I keep getting stuck at the grunt stage.

https://www.digitalocean.com/community/tutorials/how-to-install-a-mean-js-stack-on-an-ubuntu-14-04-server

There were issues with building node so I install using nvm
https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-16-04#how-to-install-using-nvm

Then there were issues with bower where the process was killed. Managed to solved that by adding swap. I have the 512 MB ram settings.
https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04

Now my problem is grunt. I now have this error.

/opt/mean$ grunt
A valid Gruntfile could not be found. Please see the getting started guide for
more information on how to configure grunt: http://gruntjs.com/getting-started
Fatal error: Unable to find Gruntfile.

Then when I tried

/opt/mean$ npm install
npm WARN checkPermissions Missing write access to /opt/mean/nodemodules/tiny-lr/nodemodules
npm WARN checkPermissions Missing write access to /opt/mean/nodemodules/tiny-lr/nodemodules/body-parser/nodemodules
npm WARN checkPermissions Missing write access to /opt/mean/node
modules/tiny-lr/nodemodules/raw-body/nodemodules
npm WARN eslint-config-airbnb@6.0.2 requires a peer of eslint-plugin-react@^4.0.0 but none was installed.
npm ERR! path /opt/mean/nodemodules/tiny-lr/nodemodules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/opt/mean/nodemodules/tiny-lr/nodemodules'
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, access '/opt/mean/nodemodules/tiny-lr/nodemodules'
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/opt/mean/nodemodules/tiny-lr/nodemodules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ktyc/.npm/logs/2017-06-17T084313072Z-debug.log

This is my second droplet try.

If anyone need me to edit the question or require more information, just leave a message.

2 Answers

Hi @tengyong80

From looking at the error log, it looks like you don't have permissions to the /opt/mean directory with the current user you're logged in as.
So either change permissions to allow that user access - or run the commands as root or with sudo.

@tengyong80

You're totally right, when you use sudo you don't need to use the root login, but your first post didn't use sudo or root.

All the errors involves some type of permissions problem, so have a look at these:
https://docs.npmjs.com/getting-started/fixing-npm-permissions
https://til.codes/npm-install-failed-with-cannot-run-in-wd-2/
https://stackoverflow.com/questions/18136746/npm-install-failed-with-cannot-run-in-wd

Have another answer? Share your knowledge.