[Bug 1192182] New: npm installation is broken
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
http://bugzilla.opensuse.org/show_bug.cgi?id=1192182 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: 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: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1192182 Andreas Stieger <Andreas.Stieger@gmx.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|screening-team-bugs@suse.de |amajer@suse.com -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1192182 http://bugzilla.opensuse.org/show_bug.cgi?id=1192182#c1 Adam Majer <amajer@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|npm installation is broken |npm: installation doesn't | |have preconfigured user | |prefix --- Comment #1 from Adam Majer <amajer@suse.com> --- npm can be install with `zypper in npm16` or `zypper in npm-default` on TW, and then you'll have npm from nodejs16. You need to configure your own prefix. With npm, you always had to do initial configuration, cd ~ mkdir my_npm_prefix npm config set prefix="$HOME/my_npm_prefix" export PATH="$PATH":$HOME/my_npm_prefix/bin npm install less -g There is not really a nice way of doing this "out of the box" as it's not nice to clobber user files and the PATH is then not set which makes -g installs moot. So, don't forget to add PATH to your .profile Furthermore, the entire global install is also legacy. Use `npx` instead (and ignore the install section there - you already have it :-) https://www.npmjs.com/package/npx -- You are receiving this mail because: You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@suse.com