-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Vite failed with projects involving cross drive links on Windows #10802
Comments
This seems to happen with symlinks #10978 (OP is using junctions). |
I guess this is related with nodejs/node#34866. |
This prevented me from moving from webpack to vite |
skill issue honestly |
I got a similar issue, it's reported this line wrong with soft link on windows: I'm not sure whether it's related to: vite/packages/vite/src/node/plugins/html.ts Line 833 in 06e4f57
Error while run command 'npm run build' as screenshot below: |
Sorry the above message. It's resolved by setting resolve.preserveSymlinks to true, works like a charm. |
@sapphi-red I'm seeing the same problem when trying to run Vite from a mapped drive. It's a corporate environment so I don't have a choice. Anonymized error for something like "\server1.mycompany.com\myProject" mapped to "T:".
I've determined that the realpath function is giving the correct path, but something is converting it to POSIX format which then breaks Example function output:
Proposed Solution(s)The suggestion by @shijh worked! However, was not required until just after version 4.1.4. I was just lucky someone else had a similar issue.
Open QuestionsWhich function is converting to POSIX paths, while dropping drive letters / network share information? |
Edit: Originally thought there was a Node bug, but it's really a naming/documentation issue causing confusion. The problem is the promises based version of "realpath" is really for "realpath.native"! It's mentioned in the documentation but it's easy to overlook. fs.realpath('T:', (e,r) => console.log(r)) // Gives "T:\\"
fs.realpath.native('T:', (e,r) => console.log(r)) // Gives "\\\\ServerName\\\MountedDirectory"
fs.realpathSync('T:') // Gives "T:\\"
fs.realpathSync.native('T:') // Gives "\\\\ServerName\\\MountedDirectory"
// The problem
await fs.promises.realpath('T:') // Gives "\\\\ServerName\\\MountedDirectory" |
So the cause has been known for over half a year. It this issue expected to be fixed any time soon? Doesn't seem like it should be difficult to someone familiar with contributing to vite? |
Unfortunately, there are multiple different problems. My issue, which deals with network drives is caused by I can't fix it during work hours without getting approval to contribute to an Open Source project, and the issue's I'm experiencing are solely related to the work environment. No one sane who has a choice does development with source code on a network share. |
As a note, I had a similar issue and setting |
Use .npmrc settings on Windows like this: node-linker=hoisted |
Describe the bug
For some reasons, I have my users dir (C:\Users) linked to another dir (D:\Users) on another disk.
When I start the dev server of a project at
C:\Users\lihe07\Desktop\solidjs-template
, vite is not working properly and some errors pops out at the console:However, the dev server started at
D:\Users\lihe07\Desktop\solidjs-template
can work properly, and give the expected output:I have also tried a vue project and the result is similar.
It also fails when I tried to build the project
npm run build
and the log can be found below.Reproduction
https://github.com/lihe07/solidjs-template
Steps to reproduce
Actually almost every vite projects in this condition can reproduce the issue:
mklink /J DEST SRC
npm i
npm run dev
ornpm run build
and the issue will emergeSystem Info
Used Package Manager
npm
Logs
Logs
vite:config bundled config file loaded in 588.18ms +0ms
vite:esbuild init tsconfck (root: C:/Users/lihe07/Desktop/solid-demo) +0ms
vite:esbuild init tsconfck (root: C:/Users/lihe07/Desktop/solid-demo) +3ms
vite:esbuild init tsconfck (root: C:/Users/lihe07/Desktop/solid-demo) +1ms
vite:esbuild init tsconfck (root: C:/Users/lihe07/Desktop/solid-demo) +0ms
vite:esbuild init tsconfck end +16ms
vite:esbuild init tsconfck end +1ms
vite:esbuild init tsconfck end +0ms
vite:esbuild init tsconfck end +0ms
vite:config using resolved config: {
vite:config plugins: [
vite:config 'vite:build-metadata',
vite:config 'vite:pre-alias',
vite:config 'alias',
vite:config 'solid',
vite:config 'unocss:transformers:pre',
vite:config 'unocss:global:build:scan',
vite:config 'vite:modulepreload-polyfill',
vite:config 'vite:resolve',
vite:config 'vite:html-inline-proxy',
vite:config 'vite:css',
vite:config 'vite:esbuild',
vite:config 'vite:json',
vite:config 'vite:wasm-helper',
vite:config 'vite:worker',
vite:config 'vite:asset',
vite:config 'unocss:config',
vite:config 'unocss:transformers:default',
vite:config 'unocss:devtools',
vite:config 'vite:wasm-fallback',
vite:config 'vite:define',
vite:config 'vite:css-post',
vite:config 'vite:build-html',
vite:config 'vite:worker-import-meta-url',
vite:config 'vite:asset-import-meta-url',
vite:config 'vite:force-systemjs-wrap-complete',
vite:config 'vite:watch-package-data',
vite:config 'commonjs',
vite:config 'vite:data-uri',
vite:config 'vite:dynamic-import-vars',
vite:config 'vite:import-glob',
vite:config 'unocss:transformers:post',
vite:config 'unocss:global:build:generate',
vite:config 'vite:build-import-analysis',
vite:config 'vite:esbuild-transpile',
vite:config 'vite:terser',
vite:config 'vite:reporter',
vite:config 'vite:load-fallback'
vite:config ],
vite:config build: {
vite:config target: 'esnext',
vite:config cssTarget: 'esnext',
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 minify: 'esbuild',
vite:config terserOptions: {},
vite:config write: true,
vite:config emptyOutDir: null,
vite:config copyPublicDir: true,
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 modulePreload: { polyfill: true }
vite:config },
vite:config optimizeDeps: {
vite:config disabled: 'build',
vite:config force: undefined,
vite:config include: [],
vite:config exclude: [],
vite:config esbuildOptions: { preserveSymlinks: false }
vite:config },
vite:config resolve: {
vite:config mainFields: [ 'module', 'jsnext:main', 'jsnext' ],
vite:config browserField: true,
vite:config conditions: [ 'solid' ],
vite:config extensions: [
vite:config '.mjs', '.js',
vite:config '.mts', '.ts',
vite:config '.jsx', '.tsx',
vite:config '.json'
vite:config ],
vite:config dedupe: [],
vite:config preserveSymlinks: false,
vite:config alias: [ [Object], [Object], [Object] ]
vite:config },
vite:config esbuild: { include: /.ts$/ },
vite:config ssr: {
vite:config format: 'esm',
vite:config target: 'node',
vite:config noExternal: [],
vite:config external: [],
vite:config optimizeDeps: { disabled: true, esbuildOptions: [Object] }
vite:config },
vite:config configFile: 'C:/Users/lihe07/Desktop/solid-demo/vite.config.js',
vite:config configFileDependencies: [ 'C:/Users/lihe07/Desktop/solid-demo/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 optimizeDeps: { force: undefined },
vite:config build: {}
vite:config },
vite:config root: 'C:/Users/lihe07/Desktop/solid-demo',
vite:config base: '/',
vite:config publicDir: 'C:\Users\lihe07\Desktop\solid-demo\public',
vite:config cacheDir: 'C:\Users\lihe07\Desktop\solid-demo\node_modules\.vite',
vite:config command: 'build',
vite:config mode: 'production',
vite:config isWorker: false,
vite:config mainConfig: null,
vite:config isProduction: true,
vite:config server: {
vite:config preTransformRequests: true,
vite:config middlewareMode: false,
vite:config fs: { strict: true, allow: [Array], deny: [Array] }
vite:config },
vite:config preview: {
vite:config port: undefined,
vite:config strictPort: undefined,
vite:config host: undefined,
vite:config https: undefined,
vite:config open: undefined,
vite:config proxy: undefined,
vite:config cors: undefined,
vite:config headers: undefined
vite:config },
vite:config env: { BASE_URL: '/', MODE: 'production', DEV: false, PROD: true },
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 packageCache: Map(0) { set: [Function (anonymous)] },
vite:config createResolver: [Function: createResolver],
vite:config worker: {
vite:config format: 'iife',
vite:config plugins: [
vite:config 'vite:build-metadata',
vite:config 'vite:pre-alias',
vite:config 'alias',
vite:config 'vite:modulepreload-polyfill',
vite:config 'vite:resolve',
vite:config 'vite:html-inline-proxy',
vite:config 'vite:css',
vite:config 'vite:esbuild',
vite:config 'vite:json',
vite:config 'vite:wasm-helper',
vite:config 'vite:worker',
vite:config 'vite:asset',
vite:config 'vite:wasm-fallback',
vite:config 'vite:define',
vite:config 'vite:css-post',
vite:config 'vite:build-html',
vite:config 'vite:worker-import-meta-url',
vite:config 'vite:asset-import-meta-url',
vite:config 'vite:force-systemjs-wrap-complete',
vite:config 'vite:watch-package-data',
vite:config 'commonjs',
vite:config 'vite:data-uri',
vite:config 'vite:dynamic-import-vars',
vite:config 'vite:import-glob',
vite:config 'vite:build-import-analysis',
vite:config 'vite:esbuild-transpile',
vite:config 'vite:terser',
vite:config 'vite:reporter',
vite:config 'vite:load-fallback'
vite:config ],
vite:config rollupOptions: {},
vite:config getSortedPlugins: [Function: getSortedPlugins],
vite:config getSortedPluginHooks: [Function: getSortedPluginHooks]
vite:config },
vite:config appType: 'spa',
vite:config experimental: { importGlobRestoreExtension: false, hmrPartialAccept: false },
vite:config getSortedPlugins: [Function: getSortedPlugins],
vite:config getSortedPluginHooks: [Function: getSortedPluginHooks]
vite:config } +472ms
vite v3.2.2 building for production...
✓ 7 modules transformed.
rendering chunks (1)...[vite:build-html] The "fileName" or "name" properties of emitted files must be strings that are neither absolute nor relative paths, received "D:/Users/lihe07/Desktop/solid-demo/index.html".
error during build:
Error: The "fileName" or "name" properties of emitted files must be strings that are neither absolute nor relative paths, received "D:/Users/lihe07/Desktop/solid-demo/index.html".
at error (file:///D:/Users/lihe07/Desktop/solid-demo/node_modules/_rollup@2.79.1@rollup/dist/es/shared/rollup.js:1858:30)
at FileEmitter.emitFile (file:///D:/Users/lihe07/Desktop/solid-demo/node_modules/_rollup@2.79.1@rollup/dist/es/shared/rollup.js:22335:24)
at Object.generateBundle (file:///D:/Users/lihe07/Desktop/solid-demo/node_modules/_vite@3.2.2@vite/dist/node/chunks/dep-c842e491.js:44203:22)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Bundle.generate (file:///D:/Users/lihe07/Desktop/solid-demo/node_modules/_rollup@2.79.1@rollup/dist/es/shared/rollup.js:15796:9)
at async file:///D:/Users/lihe07/Desktop/solid-demo/node_modules/_rollup@2.79.1@rollup/dist/es/shared/rollup.js:23795:27
at async catchUnfinishedHookActions (file:///D:/Users/lihe07/Desktop/solid-demo/node_modules/_rollup@2.79.1@rollup/dist/es/shared/rollup.js:23126:20)
at async doBuild (file:///D:/Users/lihe07/Desktop/solid-demo/node_modules/_vite@3.2.2@vite/dist/node/chunks/dep-c842e491.js:46588:22)
at async build (file:///D:/Users/lihe07/Desktop/solid-demo/node_modules/_vite@3.2.2@vite/dist/node/chunks/dep-c842e491.js:46416:16)
at async CAC. (file:///D:/Users/lihe07/Desktop/solid-demo/node_modules/_vite@3.2.2@vite/dist/node/cli.js:756:9)
Validations
The text was updated successfully, but these errors were encountered: