1

This is what I'm trying to do on my mac: npm install eslint -g

And I get a EACCES: permission denied with the following details:

npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'unlink',
npm ERR!   path: '/HOME/.node_modules_global/lib/node_modules/eslint/LICENSE' }

How can I install ESlint globally without using sudo? Or should I use sudo?

Thomas Ayoub
  • 29,063
  • 15
  • 95
  • 142
Yalda
  • 680
  • 1
  • 18
  • 39
  • 2
    The best option is use *nvm* (Node Version Manager), with it you can install several versions of nodejs in the same machine, and it save your global modules in your user folder – gabrielperales Feb 03 '16 at 14:17

1 Answers1

2

Add this to ~/.npmrc:

prefix = ${HOME}/.npm-packages

https://github.com/sindresorhus/guides/blob/master/npm-global-without-sudo.md

Also do search before you ask:
npm global path prefix
NPM modules won't install globally without sudo

Community
  • 1
  • 1
leesei
  • 6,020
  • 2
  • 29
  • 51
  • I am terribly new to `npm` and even OSX terminal and commands! Anyways, I seem to have installed it, but get `command not found` when running `eslint .` – Yalda Feb 02 '16 at 15:09
  • You also have to add `${HOME}/.npm-packages/.bin` to your `PATH` so that your shell knows where to look up the globally installed scripts. – leesei Feb 04 '16 at 01:20