Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev sever fails to start when inaccessible paths exist in project root #5765

Closed
7 tasks done
Bill-ParfulTech opened this issue Nov 19, 2021 · 4 comments · Fixed by #7603
Closed
7 tasks done

Dev sever fails to start when inaccessible paths exist in project root #5765

Bill-ParfulTech opened this issue Nov 19, 2021 · 4 comments · Fixed by #7603
Labels
bug: upstream Bug in a dependency of Vite

Comments

@Bill-ParfulTech
Copy link

Bill-ParfulTech commented Nov 19, 2021

Describe the bug

When starting the Vite Dev Server, either by the vite command or via createServer(), if there are inaccessible paths in the project root then the dev server fails to load.

Reproduction

Create a new Vite project:

$ yarn create vite test --template vue
$ cd test
$ yarn

Create a directory owned by root ( or any user other than the one running vite ), and make it inaccessible to other users:

$ sudo mkdir private
$ sudo chmod o= private

Attempt to start vite dev server:

$ yarn dev
yarn run v1.22.15
warning package.json: No license field
$ vite
error when starting dev server:
Error: EACCES: permission denied, scandir '/home/user/Projects/test/private'
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

System Info

System:
    OS: Linux 5.10 Manjaro Linux
    CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor
    Memory: 6.98 GB / xxxxGB
    Container: Yes
    Shell: 5.1.8 - /bin/bash
  Binaries:
    Node: 16.11.0 - /usr/bin/node
    Yarn: 1.22.15 - /usr/bin/yarn
    npm: 8.0.0 - /usr/bin/npm
  npmPackages:
    @vitejs/plugin-vue: ^1.9.3 => 1.9.4 
    vite: ^2.6.4 => 2.6.14

Used Package Manager

yarn

Logs

yarn run v1.22.15
warning package.json: No license field
$ /home/user/Projects/test/node_modules/.bin/vite --debug
  vite:config bundled config file loaded in 62.61ms +0ms
  vite:config using resolved config: {
  vite:config   plugins: [
  vite:config     'vite:pre-alias',
  vite:config     'alias',
  vite:config     'vite:modulepreload-polyfill',
  vite:config     'vite:resolve',
  vite:config     'vite:html-inline-script-proxy',
  vite:config     'vite:css',
  vite:config     'vite:esbuild',
  vite:config     'vite:json',
  vite:config     'vite:wasm',
  vite:config     'vite:worker',
  vite:config     'vite:asset',
  vite:config     'vite:vue',
  vite:config     'vite:define',
  vite:config     'vite:css-post',
  vite:config     'vite:client-inject',
  vite:config     'vite:import-analysis'
  vite:config   ],
  vite:config   server: { fs: { strict: undefined, allow: [Array] } },
  vite:config   define: { __VUE_OPTIONS_API__: true, __VUE_PROD_DEVTOOLS__: false },
  vite:config   ssr: { external: [ 'vue', '@vue/server-renderer' ] },
  vite:config   configFile: '/home/user/Projects/test/vite.config.js',
  vite:config   configFileDependencies: [ 'vite.config.js' ],
  vite:config   inlineConfig: {
  vite:config     root: undefined,
  vite:config     base: undefined,
  vite:config     mode: undefined,
  vite:config     configFile: undefined,
  vite:config     logLevel: undefined,
  vite:config     clearScreen: undefined,
  vite:config     server: { fs: [Object] }
  vite:config   },
  vite:config   root: '/home/user/Projects/test',
  vite:config   base: '/',
  vite:config   resolve: { dedupe: undefined, alias: [ [Object], [Object] ] },
  vite:config   publicDir: '/home/user/Projects/test/public',
  vite:config   cacheDir: '/home/user/Projects/test/node_modules/.vite',
  vite:config   command: 'serve',
  vite:config   mode: 'development',
  vite:config   isProduction: false,
  vite:config   build: {
  vite:config     target: [ 'es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1' ],
  vite:config     polyfillModulePreload: true,
  vite:config     outDir: 'dist',
  vite:config     assetsDir: 'assets',
  vite:config     assetsInlineLimit: 4096,
  vite:config     cssCodeSplit: true,
  vite:config     cssTarget: [ 'es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1' ],
  vite:config     sourcemap: false,
  vite:config     rollupOptions: {},
  vite:config     minify: 'esbuild',
  vite:config     terserOptions: {},
  vite:config     write: true,
  vite:config     emptyOutDir: null,
  vite:config     manifest: false,
  vite:config     lib: false,
  vite:config     ssr: false,
  vite:config     ssrManifest: false,
  vite:config     reportCompressedSize: true,
  vite:config     chunkSizeWarningLimit: 500,
  vite:config     watch: null,
  vite:config     commonjsOptions: { include: [Array], extensions: [Array] },
  vite:config     dynamicImportVarsOptions: { warnOnError: true, exclude: [Array] }
  vite:config   },
  vite:config   env: { BASE_URL: '/', MODE: 'development', DEV: true, PROD: false },
  vite:config   assetsInclude: [Function: assetsInclude],
  vite:config   logger: {
  vite:config     hasWarned: false,
  vite:config     info: [Function: info],
  vite:config     warn: [Function: warn],
  vite:config     warnOnce: [Function: warnOnce],
  vite:config     error: [Function: error],
  vite:config     clearScreen: [Function: clearScreen],
  vite:config     hasErrorLogged: [Function: hasErrorLogged]
  vite:config   },
  vite:config   createResolver: [Function: createResolver],
  vite:config   optimizeDeps: {
  vite:config     esbuildOptions: { keepNames: undefined, preserveSymlinks: undefined }
  vite:config   }
  vite:config } +3ms
error when starting dev server:
Error: EACCES: permission denied, scandir '/home/user/Projects/test/private'
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Validations

@kedoska
Copy link

kedoska commented Feb 10, 2022

@Bill-ParfulTech, have you found a workaround to ignore those paths?

@bluwy
Copy link
Member

bluwy commented Mar 31, 2022

I don't get any errors when trying to reproduce this, but I think that's because your code imported something in the private folder? In which case the Vite dev server failing sounds like an expected behaviour to me.

@xxx
Copy link

xxx commented Apr 1, 2022

@bluwy I have the same issue, but the private folder in my case is a bunch of data files that nothing in the app needs to be accessing.

There's no code at all in that directory. Nothing is imported from there. I can recreate this issue pretty easily with just:

cd <repo root>
mkdir foo
chmod 0 foo
<start server>

Even an empty directory will pop this.

(And no - no workaround. This issue is very frustrating)

@bluwy
Copy link
Member

bluwy commented Apr 4, 2022

Thanks for the repro steps @xxx. That helped me narrow down the bug. It's an issue in tsconfck where the findAll function tries to scan for tsconfig.json but didn't handle non accessible directories. I've created an issue at dominikg/tsconfck#51

@bluwy bluwy added bug: upstream Bug in a dependency of Vite and removed pending triage labels Apr 4, 2022
@Niputi Niputi linked a pull request Apr 4, 2022 that will close this issue
1 task
@github-actions github-actions bot locked and limited conversation to collaborators Apr 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug: upstream Bug in a dependency of Vite
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants