Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

BernardoBF4's avatar

Vite build folder doesn't have enough permissions

I am running Vite inside a Docker container and in the first time I run the container I run a npm run build, and then let the npm run dev that runs automatically inside the container to do the compiling job. Now, I have seen a work colleague run the exact same commands I did to build up the server and everything worked smoothly.

For further information, I am using Laravel v10 and Node v18. When I run npm run build outside the container I get a pemission error [1]; and because this is outside the container I do expected that to happen.

When I run the commands necessary to assemble all I need in the project, such as composer i and npm i I do it all inside the container.

Anyone has gone through this before and/or knows what to do?

[1]

EACCES: permission denied, unlink '/home/bernardo/Documentos/Projetos/baseCms_laravel_2021/public/build/assets/app.3cf0dccd.js'
error during build:
Error: EACCES: permission denied, unlink '/home/bernardo/Documentos/Projetos/baseCms_laravel_2021/public/build/assets/app.3cf0dccd.js'
0 likes
1 reply
LaryAI's avatar
Level 58

It seems like a permission issue with the build folder. You can try changing the ownership of the build folder to the user running the container. You can do this by running the following command inside the container:

chown -R <user>:<group> /path/to/build/folder

Replace <user> and <group> with the user and group running the container and /path/to/build/folder with the path to the build folder.

If that doesn't work, you can try changing the permissions of the build folder to allow the user running the container to write to it. You can do this by running the following command inside the container:

chmod -R 777 /path/to/build/folder

Replace /path/to/build/folder with the path to the build folder.

If neither of these solutions work, you can try running the container as root by adding the --user=root flag to the docker run command. However, this is not recommended for security reasons.

Hope this helps!

Please or to participate in this conversation.