symfonypermissionsyarnpkg

Sudo yarn build / Error : EACCES : permission denied, unlink


After a pull from the main branch of the project, I have an issue while trying to yarn build after a composer install and a yarn install.

Error: EACCES: permission denied, unlink '/dir/anotherdir/file.css' 

And it says at the end :

error Command failed with exit code 1.

I tried to run it with sudo yarn build, to rm -rf /nodes_modules, then to yarn cache clean, finally to yarn start or yarn build, and even to chmod 777 both the file and after that the directory but nothings seems to work.

I'd like to precise that I'm using a linux container on a VM. The project is using Symfony, Yarn, and there is no interaction with the database in this case.


Solution

  • I did find a solution in the end. As I was working on a LXC (Linux Container), the rights were not the same on my IDE's (Phpstorm) command line and the LXC command line.

    When I tried to change the roles directly from my host, I messed up the rights of the directories in the container. Changing to a user that is know on both sides solves the issue.

    NB : Seems obvious but always yarn build on the container