Vue Vite Docker WSL2. Internal server error: EACCES: permission denied, stat '/root/.node_modules/plugin-vue:export-helper'
See original GitHub issueDescribe the bug
Error running dev server in WSL2 Docker.
docker-compose:
frontend:
build: .
command: npm run dev
volumes:
- ./:/frontend
ports:
- '8080:8080'
Dockerfile:
FROM node:lts-alpine
WORKDIR /frontend
COPY package*.json ./
RUN npm install
COPY . .
CMD ["npm", "run", "dev"]
vite.config.js:
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
server: {
host: true,
port: 8080
}
})
Reproduction
https://github.com/sshiling/Vite-Vue-Docker-WSL2-Bug
System Info
System:
OS: Linux 4.19 Ubuntu 20.04 LTS (Focal Fossa)
CPU: (1) x64 Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz
Memory: 129.67 MB / 979.44 MB
Container: Yes
Shell: 5.8 - /usr/bin/zsh
Binaries:
Node: 16.13.2 - ~/.nvm/versions/node/v16.13.2/bin/node
Yarn: 1.22.5 - /usr/bin/yarn
npm: 6.14.15 - /usr/bin/npm
Used Package Manager
npm
Logs
frontend_1 | vite v2.7.13 dev server running at:
frontend_1 |
frontend_1 | > Local: http://localhost:8080/
frontend_1 | > Network: http://172.19.0.2:8080/
frontend_1 |
frontend_1 | ready in 259ms.
frontend_1 |
frontend_1 | 2:31:01 PM [vite] Internal server error: EACCES: permission denied, stat '/root/.node_modules/plugin-vue:export-helper'
frontend_1 | Plugin: vite:import-analysis
frontend_1 | File: /frontend/src/App.vue
frontend_1 | at Object.statSync (node:fs:1536:3)
frontend_1 | at isDirectory (/frontend/node_modules/resolve/lib/sync.js:31:23)
frontend_1 | at loadNodeModulesSync (/frontend/node_modules/resolve/lib/sync.js:200:17)
frontend_1 | at Function.resolveSync [as sync] (/frontend/node_modules/resolve/lib/sync.js:107:17)
frontend_1 | at resolveFrom$3 (/frontend/node_modules/vite/dist/node/chunks/dep-f5552faa.js:3911:29)
frontend_1 | at resolvePackageData (/frontend/node_modules/vite/dist/node/chunks/dep-f5552faa.js:30046:19)
frontend_1 | at /frontend/node_modules/vite/dist/node/chunks/dep-f5552faa.js:30426:15
frontend_1 | at Array.find (<anonymous>)
frontend_1 | at tryNodeResolve (/frontend/node_modules/vite/dist/node/chunks/dep-f5552faa.js:30425:44)
frontend_1 | at Context.resolveId (/frontend/node_modules/vite/dist/node/chunks/dep-f5552faa.js:30257:28)
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:10
- Comments:20 (3 by maintainers)
Top Results From Across the Web
26 - Stack Overflow
How do you list volumes in docker containers? 5 · EACCES: permission denied mkdir ... while trying to use docker volumes in a...
Read more >Dockerize Vue.js App
Let's start by creating a Dockerfile in the root folder of our project: FROM node:lts-alpine # install simple http server for serving static...
Read more >EACCES: permission denied : r/docker - Reddit
The problem is caused by Vite. It's trying to create a /app/node_modules/.vite directory just before launching the web server. Before the USER ...
Read more >How to Fix Docker Permission Denied? - phoenixNAP
Docker outputs the "Permission Denied" error when a non-root user without sufficient privileges attempts to execute a Docker command.
Read more >Troubleshooting Docker Permission Denied Problems
Many factors could lead to a permission denied error while connecting to Docker. One of those factors is that you may be running...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Getting the same error on Ubuntu 20.04 in combination with docker
Downgrading to 2.6.14 works as a quick workaround but should not be the fix. @patak-dev do you have any solution?