Bug ID 1192182
Summary npm installation is broken
Classification openSUSE
Product openSUSE Tumbleweed
Version Current
Hardware x86-64
OS openSUSE Tumbleweed
Status NEW
Severity Normal
Priority P5 - None
Component Other
Assignee screening-team-bugs@suse.de
Reporter php4fan@gmail.com
QA Contact qa-bugs@suse.de
Found By ---
Blocker ---

Steps to reproduce:

- Install nodejs with "sudo zypper install nodejs-common" (I'm not really sure
if I installed it directly like this or if it got installed as a dependency of
some other package, or if it was even installed from the beginning from a fresh
OpenSUSE installation)
- Try to install a nodejs package "globally" via npm with:

   npm install less -g

Do NOT use sudo. You are not supposed to run npm as root, ever.

"less" is just an example, any package should reproduce the issue.


Expected behavior:
Should install the package "globally". Globally means globally to the user. A
decent installation of nodejs and npm should be configured so that the
directory for globally installed packages is somewhere within the user's home
directory, or somewhere that, one way or another, WORKS out of the box, while
not being run as root.


Observed result:
> npm install less -g
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules'
npm ERR!  [Error: EACCES: permission denied, mkdir
'/usr/local/lib/node_modules'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as
the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check
the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.


I assume it would work if I ran it with sudo, but I shouldn't be required to do
that, and it can mess things up so I'm not even going to try it (source
https://medium.com/@ExplosionPills/dont-use-sudo-with-npm-still-66e609f5f92).


You are receiving this mail because: