Closed Jonas-360ty closed 1 year ago
SAME issue here, so I can CONFIRM this.
As you can see, it happens with a BRAND NEW Vite install, per the basic 'intro' install instructions:
You can also see that it is even happening when the network drive is MAPPED to a drive letter.
I'm getting the same issue. What is occuring is that the hostname is getting prepended to the path of the depency rather than the drive letter.
instead of:
W:/Github/three-tools/three-testing
output is:
/192.168.19.11/Ausgabe_Files/Github/three-tools/three-testing
this is what is generating the code: https://github.com/vitejs/vite/blob/b582581761519a14424e707131a8818de35fd2c4/packages/vite/src/node/optimizer/index.ts#L236-L253
The issue could be coming from the result of this regex: https://github.com/vitejs/vite/blob/b582581761519a14424e707131a8818de35fd2c4/packages/vite/src/node/utils.ts#L34-L35
I can confirm the same prepended behavior and possible trigger.
import {Map, View} from './node_modules/ol'; // trigger the error
BOOM!
In my case when node_modules\ol\layer\BaseVector.js trys to import rbush (line 20) things start to blow up:
import Layer from './Layer.js';
import RBush from 'rbush';
import { assign } from '../obj.js';
So esbuild (I think) tries to look for rbush. Interestingly, the dir rbush is in node_modules
I think serve uses rollup and might do the traditional node_modules walk up the directory tree then find rbush
Some non-vitejs file are transformed from the ol package, however, when ol says it needs rbush and rbush says it needs quickselect things go of the rails. Compare the path to the ones in Mapped drive paths
✓ 157 modules transformed. [vite:load-fallback] Could not load /home.fs.bcit.ca/Dev1/xxxxxxxxx/var/gist/7132/wksp_web/test_vite_06/node_modules/rbush/index.js (imported by node_modules\ol\layer\BaseVector.js): ENOENT: no such file or directory, open 'Z:\home.fs.bcit.ca\Dev1\xxxxxxxxx\var\gist\7132\wksp_web\test_vite_06\node_modules\rbush\index.js'
publicDir: 'Z:\var\gist\7132\wksp_web\test_vite_06\public' Z:\var\gist\7132\wksp_web\test_vite_06\ Z:\var\gist\7132\wksp_web\test_vite_06\node_modules Z:\var\gist\7132\wksp_web\test_vite_06\node_modules\rbush\index.js
I hope this helps.
Also been facing this issue for ages before finally figuring out the cause. Was trying to use Vite with Inertia for Laravel and receiving errors like the following:
dep:@inertiajs_inertia-vue3:1:23: ERROR: Could not resolve "./C:/Users/Deji/Cloud/WebDev/Project/www/icarush/node_modules/.pnpm/@inertiajs+inertia-vue3@0.6.0_91b43248bdff72beadf7eb88a4aefff2/node_modules/@inertiajs/inertia-vue3/dist/index.js"
Turns out it was due to the fact I had set up the project under U:/WebDev/Project/www/icarush
with U:\
being mapped to C:/Users/Deji/Cloud/
. Vite must have been expanding the mapping or something and getting confused on translating the paths. Running vite directly under the non-mapped C:\
path works around the issue.
Same issue here, Help~
Same issue here, Help~
You have to enable the preserveSymlinks
option inside the vite config. For react vite it should look like this:
export default defineConfig({
plugins: [react()],
resolve: {
preserveSymlinks: true
}
})
Same issue here, Help~
You have to enable the
preserveSymlinks
option inside the vite config. For react vite it should look like this:export default defineConfig({ plugins: [react()], resolve: { preserveSymlinks: true } })
This works with me on vite, vue3, superb.
I think using resolve { preserveSymlinks: true }
here is ok to support this use case. We also recently did some changes to how preserve links false work, so worth trying it out again. Closing this issue as the workaround seems good enough for the folks involved in this thread.
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
npm init vite@latest <project-name>
)npm i
to install dependenciesnow try doing the same thing on a local disk and it'll work just fine
System Info
Used Package Manager
npm
Logs
Validations