-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Fails on running in a symbolic linked directory #9327
Comments
Real life use case: moving |
It's likely on this line that we didn't take into account of this specific case. vite/packages/vite/src/node/optimizer/index.ts Lines 914 to 918 in 1c1cf43
Or the other possibility is that esbuild doesn't correctly return the |
function esbuildOutputFromId(outputs, id, cacheDirOutputPath) {
const flatId = flattenId(id) + '.js';
// ---
const wd = process.cwd();
const rel = path$n.relative(process.cwd(), path$n.join(cacheDirOutputPath, flatId));
const norm = normalizePath$3(rel);
console.log(wd); // C:\projects\linked-dir
console.log(rel); // node_modules\.vite\deps_temp\vue.js
console.log(norm); // node_modules/.vite/deps_temp/vue.js
console.log(Object.keys(outputs));
// [
// '../linked-dir/node_modules/.vite/deps_temp/vue.js.map',
// '../linked-dir/node_modules/.vite/deps_temp/vue.js'
// ]
// ---
return outputs[normalizePath$3(path$n.relative(process.cwd(), path$n.join(cacheDirOutputPath, flatId)))];
} |
I had the same issue and I searched for 30 min ton understand what was going on... |
@patak-dev You reopened this Issue? I am currently still experiencing this with v3.2.5 which I would assume would contain the fix since it was released 2 weeks ago. What's the status on this? |
I guess this is related with nodejs/node#34866, similar to #10802. |
Have the same issue on node v16.14.0 it shows
on node v14.20.0
System info
|
Same issue trying to create a template Svelte app. VITE v4.0.4 ready in 343 ms
➜ Local: http://localhost:5173/
➜ Network: use --host to expose
➜ press h to show help
file:///C:/Users/KARL/Dev/test.LAB/learn.webdev/learning/client/my-svelte-project/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:42832
fileHash: getHash(metadata.hash + depsInfo[id].file + JSON.stringify(output.imports)),
^
TypeError: Cannot read properties of undefined (reading 'imports')
at runOptimizeDeps (file:///C:/Users/KARL/Dev/test.LAB/learn.webdev/learning/client/my-svelte-project/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:42832:89)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js v18.13.0 |
I search many sites, finally I know why my program failed to work! |
Still relevant found to be repeatable in vite as of node versions LTS (v20.11.1) and latest (v21.6.2) and vite (^5.0.11).
|
|
I would like to provide some of my findings to help resolve this issue:
for (const [key, value] of Object.entries(outputs)) {
if (key.includes('react.js') && id == 'react') {
console.log('cwd: ', cwd) // /Users/linhuangdong/Git/projectRoot
console.log('key: ', key) // ../user/node_modules/.vite/deps_temp_ee3bd11b/react.js
console.log('normalizedOutputPath: ', normalizedOutputPath) // packages/user/node_modules/.vite/deps_temp_ee3bd11b/react.js
}
if (normalizePath$3(path$n.relative(cwd, key)) === normalizedOutputPath) {
return value;
}
} |
Describe the bug
Vite fails when I try to use it in a sym-linked directory.
Run in CMD:
Error:
Reproduction
Auto-generated
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: