Skip to content

EPERM error with .local/share directory after installing CLI #521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rosen-vladimirov opened this issue Jun 4, 2015 · 5 comments
Closed
Assignees
Milestone

Comments

@rosen-vladimirov
Copy link
Contributor

Problem

In case on Mac and Linux I do not have ~/.local directory, after installing CLI with sudo sudo npm i -g nativescript, I cannot access ~/.local and ~/.local/share directories. Some other applications are trying to use them after that and they are failing as the directories are created with root owner instead of my own user.

Implementation details

The reason is that we are creating .nativescript-cli cache directory insider ~/.local/share and if the path above does not exist, installing CLI with sudo leads to creation of ~/.local and ~/.local/share directories with root owner. Inside CLI we have code to change the owner of .nativescript-cli directory to current user, but it is not applied to ~/.local and ~/.local/share directories which may have been created from the same process.

Workaround

The workaround is to change the owner of ~/.local and all its subdirectories to your user.
sudo chown -R <username> ~/.local

@everflux
Copy link

I assume the reason for this is as follows:
On Ubuntu you install nativescript as root in order to install it globally
sudo npm install -g nativescript
During the setup the nativescript installer creates a config file when asking for permission to send usage data to telerik. This file and correspondin directory is created still as super user.
Therefore when creating a new project - as a regular user - the permissions forbid to create the lock file

EACCES: permission denied, open '/home/user/.local/share/.nativescript-cli/.lock'

A simple workaround would be to delay the question and configuration file creation until the first run of tns, which then is performed with the correct user account.

@Makiavelo
Copy link

Make a note on the docs about this issue for linux users; http://docs.nativescript.org/angular/tutorial/ng-chapter-1

@rosen-vladimirov rosen-vladimirov added this to the 2.6.0 (TBD) milestone Jan 12, 2017
@rosen-vladimirov rosen-vladimirov self-assigned this Jan 12, 2017
@pkoleva pkoleva modified the milestone: 2.6.0 (TBD) Jan 26, 2017
@pkoleva pkoleva added this to the 3.0.0-RC milestone Feb 24, 2017
@pkoleva pkoleva removed this from the 3.0.0-RC milestone Apr 3, 2017
@etabakov etabakov added this to the 3.1.0 milestone Apr 27, 2017
@pkoleva
Copy link
Contributor

pkoleva commented May 30, 2017

Hey guys, @Makiavelo @everflux

We now have a fix for that in our @next, so if you're still encountering it you can try the latest bits and share if it works for you.

@Agbongbenj
Copy link

sudo chown -R ~/.local
thanks the above solved it for me

@ammaratef45
Copy link

ammaratef45 commented Jul 9, 2018

I have similar issue
I have ubuntu 14.04, tried sudo chown ammar -R ~/.local where ammar is my user name but the issue still there

EACCES: permission denied, open '/home/ammar/.local/share/.nativescript-cli/user-settings.json.lock'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants