question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vue Vite Docker WSL2. Internal server error: EACCES: permission denied, stat '/root/.node_modules/plugin-vue:export-helper'

See original GitHub issue

Describe 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
  }
})

screenshot4

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:10
  • Comments:20 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
nickvdwaalcommented, Feb 8, 2022

Getting the same error on Ubuntu 20.04 in combination with docker

5reactions
nickvdwaalcommented, Feb 8, 2022

Downgrading to 2.6.14 works as a quick workaround but should not be the fix. @patak-dev do you have any solution?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found