-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Description
Describe the bug
What's the problem?
When creating a vite project on a network drive, any import from a node modules (that is not a dependency of vite) will throw an "Error: ENOENT: no such file or directory" Error.
It happens with a minimal vite setup without another framework, as well as on a vite-react project
Here is the Error message:
Error: ENOENT: no such file or directory, open '/192.168.19.11/Ausgabe_Files/Github/three-tools/three-testing/node_modules/react/index.js' at Object.openSync (fs.js:476:3) at Object.readFileSync (fs.js:377:35) at optimizeDeps (C:\Users\360ty\AppData\Roaming\nvm\v14.16.1\node_modules\vite\dist\node\chunks\dep-36bf480c.js:71704:42) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async runOptimize (C:\Users\360ty\AppData\Roaming\nvm\v14.16.1\node_modules\vite\dist\node\chunks\dep-36bf480c.js:75494:48) at async Server.httpServer.listen (C:\Users\360ty\AppData\Roaming\nvm\v14.16.1\node_modules\vite\dist\node\chunks\dep-36bf480c.js:75510:21)
Reproduction
- Connect to any network drive.
- create a vite project on the network drive (
npm init vite@latest <project-name>) - run
npm ito install dependencies - install any node module that is not part of vite (e.g: react)
- import anything from the module to your main file.
- try running "vite" in the terminal
- the error will now occur
now try doing the same thing on a local disk and it'll work just fine
System Info
System:
OS: Windows 10 10.0.19042
CPU: (4) x64 Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz
Memory: 564.13 MB / 7.91 GB
Binaries:
Node: 14.16.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.11 - C:\Program Files\nodejs\yarn.CMD
npm: 6.14.12 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 93.0.4577.82
Edge: Spartan (44.19041.1023.0), Chromium (93.0.961.52)
Internet Explorer: 11.0.19041.1202
npmPackages:
vite: ^2.5.4 => 2.5.10Used Package Manager
npm
Logs
vite:config bundled config file loaded in 2049ms +0ms
vite:config using resolved config: {
vite:config plugins: [
vite:config 'vite:pre-alias',
vite:config 'alias',
vite:config 'react-refresh',
vite:config 'vite:modulepreload-polyfill',
vite:config 'vite:resolve',
vite:config 'vite:html',
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: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 configFile: 'W:/Github/three-tools/three-testing/vite.config.ts',
vite:config configFileDependencies: [ 'vite.config.ts' ],
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: 'W:/Github/three-tools/three-testing',
vite:config base: '/',
vite:config resolve: { dedupe: undefined, alias: [ [Object], [Object] ] },
vite:config publicDir: 'W:\\Github\\three-tools\\three-testing\\public',
vite:config cacheDir: 'W:\\Github\\three-tools\\three-testing\\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 sourcemap: false,
vite:config rollupOptions: {},
vite:config commonjsOptions: { include: [Array], extensions: [Array] },
vite:config dynamicImportVarsOptions: { warnOnError: true, exclude: [Array] },
vite:config minify: 'terser',
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 brotliSize: true,
vite:config chunkSizeWarningLimit: 500,
vite:config watch: null
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: { esbuildOptions: { keepNames: undefined } }
vite:config } +12ms
vite:deps Crawling dependencies using entries:
vite:deps W:/Github/three-tools/three-testing/index.html +0ms
vite:resolve 1ms /src/main.tsx -> W:/Github/three-tools/three-testing/src/main.tsx +0ms
vite:resolve 19ms react -> /192.168.19.11/Ausgabe_Files/Github/three-tools/three-testing/node_modules/react/index.js +24ms
vite:resolve 14ms react-dom -> /192.168.19.11/Ausgabe_Files/Github/three-tools/three-testing/node_modules/react-dom/index.js +16ms
vite:resolve 3ms ./App -> W:/Github/three-tools/three-testing/src/App.tsx +6ms
vite:deps Scan completed in 147ms: {
react: '/192.168.19.11/Ausgabe_Files/Github/three-tools/three-testing/node_modules/react/index.js',
'react-dom': '/192.168.19.11/Ausgabe_Files/Github/three-tools/three-testing/node_modules/react-dom/index.js'
} +122msValidations
- 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/vue-next 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.