Reputation: 121
I am new to Flutter, and after installing it, I got this error when I tried to create a project.
[hello_world] flutter create --ios-language swift --android-language kotlin .
Failed to open or create the artifact cache lockfile: "FileSystemException: Cannot open file, path = '/home/raphael/flutter/flutter/bin/cache/lockfile' (OS Error: Permission denied, errno = 13)"
Please ensure you have permissions to create or open /home/raphael/flutter/flutter/bin/cache/lockfile
Failed to open or create the lockfile
exit code 1
I can't find any way to fix this, so I'd be glad if someone helps me :)
Thank you!
Upvotes: 11
Views: 32104
Reputation: 953
$ sudo chown -R <username> /Users/<username>/.config
or this one work for me
$ sudo chmod 775 <username> /Users/<username>/.config
For full right
$ sudo chmod 777 <username> /Users/<username>/.config
Please, make sure to replace <username>
by your account username.
Upvotes: 1
Reputation: 91
Try this:
sudo chown -R [user]:root /opt/flutter
It worked for me on Manjaro Linux.
Upvotes: 9
Reputation: 31
Try this, worked in my ubuntu 18.04.
First set the ownership of the folder:
sudo chown -R $USER:$USER ~/development/flutter
If you still have the error set this permission:
sudo chmod 754 development/flutter/
Upvotes: 3
Reputation: 11
To solve this error, I opened the terminal with administrator privileges and It worked! Hope this helps you.
Upvotes: 1
Reputation: 2973
Check permission for the mentioned directory via:
ls -l /home/raphael/flutter/
the flutter subfolder in there should have the same user id (or the group) as your current user, with whom you are trying to create the project.
If not, while being in the folder mentioned above, try to change permission on the folder via:
chown -R YOUR_USERNAME flutter
Run the first command again to verify that the apropriate user is now shown on the folder. Then try to create the project again.
Upvotes: 32