Bit: file permission errors on various action and commands

Created on 2 Jul 2019  Â·  5Comments  Â·  Source: teambit/bit

There are many errors that are reported anonymously through Bit about file-access issues.

EACCES: permission denied, open '<path>/.git/bit/objects/a5/...106f01f31f73feed'
EACCES: permission denied, mkdir '/opt/bit/first-scope/objects/06'
EACCES: permission denied, open '<path>/package.json'
EACCES: permission denied, rmdir '<path>/node_modules/@bit/<component-id>/dist'

It's hard to triage the issues, as I was unable to recreate them locally. However, these are the most common type of errors. I assume that they happen when any file/dir that was created in a project was not assigned with the correct permission afterward, so the permissions used when running the Bit command are not enough to read/write a file.

typbug

Most helpful comment

Continuing an offline conversation:

Suggested warning messages:

Instead of EACCESS:
Error: You do not have permissions to access <file-list>, were you running bit as root?

When running bit as root:
Warning: running bit as root might cause permission issues later.

All 5 comments

thought - this most likely happens when either an npm or bit command ran as root. some files/dirs require root permissions, so when running a command as another account - it breaks.

Bit cannot access files or directories. Make sure Bit has proper access permissions.

Continuing an offline conversation:

Suggested warning messages:

Instead of EACCESS:
Error: You do not have permissions to access <file-list>, were you running bit as root?

When running bit as root:
Warning: running bit as root might cause permission issues later.

I think that the error should be extended and include that this error might occur if the user ran npm/yarn/git command as sudo.

So perhaps something like this:

error: you do not have permissions to access <file-list>, were you running bit, npm or git as root?

Note - I've removed the reference to the eject error, as this error occurs on several occasion, not only permission issues (happens when npm gets 404 and 401 as well). I suggest handling it specifically as its own case.

I was able to reproduce it easily by running the following:

➜  touch aaa.js
➜  sudo bit add aaa.js
tracking component aaa:
added aaa.js
➜  bit tag -a
EACCES: permission denied, open '/tmp/wp/.bit/index.json'

Changed the error message and added a warning when a user is using sudo.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

manuel-minniti picture manuel-minniti  Â·  3Comments

idkjs picture idkjs  Â·  4Comments

lubomir-chatoryiskyi picture lubomir-chatoryiskyi  Â·  3Comments

hwclass picture hwclass  Â·  3Comments

amadeogallardo picture amadeogallardo  Â·  4Comments