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

Invalid cross-device link when shipping npm specified modules to browser #76

Closed
ewired opened this issue Jul 7, 2023 · 2 comments · Fixed by #79
Closed

Invalid cross-device link when shipping npm specified modules to browser #76

ewired opened this issue Jul 7, 2023 · 2 comments · Fixed by #79

Comments

@ewired
Copy link

ewired commented Jul 7, 2023

Bundling in Fresh with npm specifiers has this issue when /tmp and home are on two different filesystems:

      detail: Error: Invalid cross-device link (os error 18): link '/var/home/ewired/.cache/deno/npm/registry.npmjs.org/preact/10.15.1/LICENSE' -> '/tmp/68aa0db9/LICENSE'
    at async Object.link (ext:deno_fs/30_fs.js:401:3)
    at async linkRecursive (https://deno.land/x/esbuild_deno_loader@0.8.1/src/loader_native.ts:165:5)
    at async linkRecursive (https://deno.land/x/esbuild_deno_loader@0.8.1/src/loader_native.ts:162:7)
    at async NativeLoader.#nodeModulesDirForPackageInner (https://deno.land/x/esbuild_deno_loader@0.8.1/src/loader_native.ts:126:5)
    at async NativeLoader.nodeModulesDirForPackage (https://deno.land/x/esbuild_deno_loader@0.8.1/src/loader_native.ts:80:17)
    at async onResolve (https://deno.land/x/esbuild_deno_loader@0.8.1/src/plugin_deno_loader.ts:261:28)
    at async requestCallbacks.on-resolve (https://deno.land/x/esbuild@v0.17.19/mod.js:1336:22)
    at async handleRequest (https://deno.land/x/esbuild@v0.17.19/mod.js:699:13) {
        code: "EXDEV"
@ngasull
Copy link
Contributor

ngasull commented Jul 31, 2023

Ran into this as well and spotted 2 issues

Hard link

Fails as it doesn't make sense when pointing on separate filesystems.

If keeping the hardlink strategy, I see only 2 solutions :

  1. Making a custom temporary folder directly inside DENO_DIR.
  2. Falling back with a separate copy-based strategy

Rename

Fails because Deno.rename just runs the underlying syscall.

std/fs has move but it actually doesn't handle separate file systems. This has been noticed recently and there's a PR on Deno.rename but Ryan goes in the direction of including the case in std, which makes sense.

Anyhow, solving the rename won't solve the hard link strategy !

@ngasull
Copy link
Contributor

ngasull commented Jul 31, 2023

I actually followed up with solution 1. 👉 #79

@ewired you may solve your issue by temporarily importing from my fork as well

Use at your own risk 🙃
import { denoPlugins } from "https://raw.githubusercontent.com/ngasull/esbuild_deno_loader/58b5225aff2f9064607ec52cab8a6d7e4b13d4e5/mod.ts";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants