Prevent permission errors at installation
If you see an EACCES error when you try to install a lumber-cli globally, follow this tutorial.
Depending on how you've installed Node.js on your system, you could encounter a permissions error EACCES similar to the following output.
In this case, I got the error on a EC2 instance running on Ubuntu 10.04 with Node v8.10.0 and NPM v.3.5.2. But you can have this similar problem on another system and node version.
1
npm ERR! Linux 4.15.0-1021-aws
2
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "lumber-cli" "--save"
3
npm ERR! node v8.10.0
4
npm ERR! npm v3.5.2
5
npm ERR! path /usr/local/lib
6
npm ERR! code EACCES
7
npm ERR! errno -13
8
npm ERR! syscall access
9
10
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib'
11
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib'
12
npm ERR! errno: -13,
13
npm ERR! code: 'EACCES',
14
npm ERR! syscall: 'access',
15
npm ERR! path: '/usr/local/lib' }
16
npm ERR!
17
npm ERR! Please try running this command again as root/Administrator.
18
19
npm ERR! Please include the following file with any support request:
20
npm ERR! /home/ubuntu/npm-debug.log
Copied!
The problem is because NPM does not have the write access to the directory that will contain the package you want to install (here lumber-cli).
To solve this issue, we recommend to override the default directory where your global NPM packages will be stored.
1
mkdir ~/.npm-global
Copied!
Then, configure NPM to use this directory instead of the default one:
1
npm config set prefix '~/.npm-global'
Copied!
Then, make the node executables accessible from your PATH. To do so, export the environment variable PATH by opening or creating the file ~/.profile and add this line at the end:
~/.profile
1
export PATH=~/.npm-global/bin:$PATH
Copied!
Finally, reload the ~/.profile file:
1
source ~/.profile
Copied!
That's it, now you should be able to install lumber without any error 🎉
1
npm install -g lumber-cli
Copied!
Last modified 1yr ago
Copy link