Can't install Ember CLI without root


I have installed node with sodu.

after that when i’m trying to install ember-cli i am getting this issue…

npm install -g ember-cli
npm http GET
npm http 200
npm http GET
npm http 200
npm WARN engine ember-cli@0.0.44: wanted: {"node":">= 0.10.0"} (current: {"node":"v0.8.21","npm":"1.1.71"})
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/ember-cli'
npm ERR!  { [Error: EACCES, mkdir '/usr/local/lib/node_modules/ember-cli']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/usr/local/lib/node_modules/ember-cli',
npm ERR!   fstream_type: 'Directory',
npm ERR!   fstream_path: '/usr/local/lib/node_modules/ember-cli',
npm ERR!   fstream_class: 'DirWriter',
npm ERR!   fstream_stack: 
npm ERR!    [ 'DirWriter._create (/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23)',
npm ERR!      '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53',
npm ERR!      'Object.oncomplete (fs.js:297:15)' ] }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.2.0-61-generic
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "ember-cli"
npm ERR! cwd /home/ahmed
npm ERR! node -v v0.8.21
npm ERR! npm -v 1.1.71
npm ERR! path /usr/local/lib/node_modules/ember-cli
npm ERR! fstream_path /usr/local/lib/node_modules/ember-cli
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/ember-cli'
npm ERR! fstream_stack DirWriter._create (/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23)
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:297:15)
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/ahmed/npm-debug.log
npm ERR! not ok code 0

please help


When installing with sudo…

sudo npm install -g ember-cli /usr/local/bin/ember -> /usr/local/lib/node_modules/ember-cli/bin/ember npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/npm-registry-client/node_modules/couch-login requires request@’~2.9.202’ but will load npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/request, npm WARN unmet dependency which is version 2.30.0 ember-cli@0.0.44 /usr/local/lib/node_modules/ember-cli ├── abbrev@1.0.5 ├── js-string-escape@1.0.0 ├── broccoli-writer@0.1.1 (rsvp@3.0.13, quick-temp@0.1.2) └── yam@0.0.14 (lodash@2.4.1, findup@0.1.5, fs-extra@0.8.1) ahmed@shivank-Vostro-2420:~$ ember -v version: 0.0.44 node: 0.10.31 npm: 1.4.26


I recently had to fix this issue on my own machine and, for someone not used to Bash and all the fun it can do, it was a bit annoying.

There were a couple of SO questions that helped:

  1. npm / yeoman install generator-angular without sudo
  2. what is PATH on the MAC (UNIX) system
  3. What does echo prefix = ~/.node >> ~/.npmrc mean?

Heres what the CLI Docs say about it. In short, the CLI team purposefully does not support installing the CLI globally because installing something with SUO is a very unsafe practice.


@ahmadhasankhan check the post here it will help you install node and npm without requiring sudo.


Thanks @joseph_dillon_522 and @abuiles, problem has been solved, now i am using nvm, updraded Node version and CLI working fine :smile:


Follow this guide to install node without sudo

I also needed to run sudo chown -R $USER:$GROUP ~/.npm