Failed to download Realm CLI under Linux

Hi, I under Ubuntu 20.04.3 LTS with nodejs v16.10.0 and npm v6.14.13

When I try to install the Realm CLI like this (with and without sudo) :

npm install -g mongodb-realm-cli

I have this error :

downloading “realm-cli” from “
failed to download Realm CLI: Error: EACCES: permission denied, open ‘/usr/lib/node_modules/mongodb-realm-cli/realm-cli’
at Object.openSync (node:fs:585:3)
at /usr/lib/node_modules/mongodb-realm-cli/install.js:62:24
at new Promise ()
at requstBinary (/usr/lib/node_modules/mongodb-realm-cli/install.js:56:10)
at Object. (/usr/lib/node_modules/mongodb-realm-cli/install.js:101:1)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions…js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12) {
errno: -13,
syscall: ‘open’,
code: ‘EACCES’,
path: ‘/usr/lib/node_modules/mongodb-realm-cli/realm-cli’

I checked the owner of /usr/lib/node_modules, it is “root:root”. I tried to change the owner, tried in sudo …Etc. Always the same error.

Any idea?

Thank you for your help

Hi @Frederic_Meriot,

Seems like your /usr/lib/node_modules has the wrong permissions?

Can you ls -al /usr/lib/node_modules/mongodb-realm-cli/ and ls -al /usr/lib/node_modules/mongodb-realm-cli/realm-cli and post here the listings to have a look?

Running as sudo also fails? Then root doesn’t have enough permissions… Although it’s a security problem I’ll try to chmod -R 777 /usr/lib/node_modules/mongodb-realm-cli/ and try again

Let us know and thanks for posting!


1 Like

The problem is that there is no mongodb-realm-cli under /usr/lib/node_module. NPM install does not succeed in creating the mongodb-realm-cli directory.

And for this command :

I have this output :

╰─ ls -al /usr/lib/node_modules/
total 32
drwxrwxrwx   8 root root 4096 sept. 29 09:13 .
drwxr-xr-x 130 root root 4096 août  19 15:39 ..
drwxrwxrwx   3 root root 4096 avril 30 11:37 @angular
drwxrwxrwx   4 root root 4096 avril 28 09:43 aws-azure-login
drwxrwxrwx   4 root root 4096 sept. 28 15:29 corepack
drwxrwxrwx   3 root root 4096 juin   7 10:32 n
drwxrwxrwx   3 root root 4096 sept. 13 12:05 @nestjs
drwxrwxrwx   8 root root 4096 sept. 28 15:29 npm

As you can see I’ve also tried a chmod 777 before without success …

Forget about my problem. I figure it out.
I realized that I was using “n” npm which allows you to switch from one version of nodejs to another, and I also installed nodejs with apt-get. So, big conflict. I removed the nodejs installed with apt-get, and everything works fine.

Thank you.


I had the same problem on Ubuntu 20.04, node v14.18.3, npm 6.14.15, what actually worked for me is:

sudo npm install -g mongodb-realm-cli --unsafe-perm=true --allow-root

adding --unsafe-perm=true --allow-root did the trick.


I got this error while installing

sudo npm install -g mongodb-realm-cli --unsafe-perm=true --allow-root
npm WARN deprecated request@2.88.2: request has been deprecated, see
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See for details.
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
[            ......] \ extract:ajv: sill extract ajv@^6.12.3 extracted to /usr/lib/node_modules/.staging/ajv-2d511643 (328ms)

I got the same issue. Could you solve it?