Can't run "NPM install" on opensuse

hello, I’m encountering an issue when trying to run npm install on my openSUSE system. Here are the details:

  • OS Version: openSUSE 1.56 leap
  • Node.js Version: nodejs20

I’ve tried updating Node.js and npm, and checking permissions (but i dont know where permission setting in opensuse), and nothing seems to work. Any assistance would be greatly appreciated!

here’s the error:

The error indicates a lack of permissions at the destination - I’d start that way. You’re not using a standard prompt, so if you’re not running this as root, that is an option as well, but if you want to go with the principle of least privileges, check the permissions on the destination directory.

Hi,
I think the directory /usr/local/lib/node_module check the permission on it. I had the same issue with node. Even though I tried to give the permission but it still has an issue.

which nodjs
which: no nodjs in (/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/home/rhussain/.local/bin:/home/rhussain/bin:/usr/local/bin:/usr/bin:/bin)
npm install http-server -g
npm error code EACCES
npm error syscall mkdir
npm error path /usr/local/lib/node_modules
npm error errno -13
npm error Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules'
npm error     at async mkdir (node:internal/fs/promises:863:10)
npm error     at async /usr/lib64/node_modules/npm22/node_modules/@npmcli/arborist/lib/arborist/reify.js:624:20
npm error     at async Promise.allSettled (index 0)
npm error     at async [reifyPackages] (/usr/lib64/node_modules/npm22/node_modules/@npmcli/arborist/lib/arborist/reify.js:325:11)
npm error     at async Arborist.reify (/usr/lib64/node_modules/npm22/node_modules/@npmcli/arborist/lib/arborist/reify.js:142:5)
npm error     at async Install.exec (/usr/lib64/node_modules/npm22/lib/commands/install.js:150:5)
npm error     at async Npm.exec (/usr/lib64/node_modules/npm22/lib/npm.js:207:9)
npm error     at async module.exports (/usr/lib64/node_modules/npm22/lib/cli/entry.js:74:5) {
npm error   errno: -13,
npm error   code: 'EACCES',
npm error   syscall: 'mkdir',
npm error   path: '/usr/local/lib/node_modules'
npm error }
npm error
npm error The operation was rejected by your operating system.
npm error It is likely you do not have the permissions to access this file as the current user
npm error
npm error If you believe this might be a permissions issue, please double-check the
npm error permissions of the file and its containing directories, or try running
npm error the command again as root/Administrator.
npm error A complete log of this run can be found in: /home/rhussain/.npm/_logs/2024-10-18T23_44_32_008Z-debug-0.log

How did you install NPM and nodejs?

It kinda looks like you used brew rather than the package manager, but based on what you’ve written it’s not possible to tell how you installed it or who you were when you ran the commands.

EACCES is an access error. “nodjs” is not the command, it’s “node” when installed using the native packages.

But it looks like you’re trying to install http-server as a global user, so if you’re not root (which it isn’t possible to tell if that’s the case or not), you won’t be able to install it because normal users can’t write to /usr/lib64/* - and setting normal users up to do that is a bad idea from a security standpoint.

The errors at the end of your log state that you should run the command as root/Administrator, so that tells me you’re probably not doing that. :slight_smile:

I discovered the issue was due to running npm on an exFAT drive. since exFAT file systems does not support ownership permissions.
I was able to resolve the problem by executing the command on my ext4 drive instead.

1 Like

Ah, yes, that would do it as well. Glad you figured it out!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.