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

bug: [plugin externalize-deps] EINVAL: invalid argument, stat #9

Closed
mathe42 opened this issue Oct 12, 2022 · 10 comments · Fixed by vitejs/vite#10446
Closed

bug: [plugin externalize-deps] EINVAL: invalid argument, stat #9

mathe42 opened this issue Oct 12, 2022 · 10 comments · Fixed by vitejs/vite#10446

Comments

@mathe42
Copy link

mathe42 commented Oct 12, 2022

System

Windows 10
deno 1.26.1

Reproduction

  1. deno run -A --unstable npm:create-vite-extra
  2. select deno-vue
  3. cd into folder
  4. run deno task dev

Full logs:

Warning deno task is unstable and may drastically change in the future
Task dev deno run -A --unstable --node-modules-dir npm:vite
✘ [ERROR] [plugin externalize-deps] EINVAL: invalid argument, stat

    vite.config.mjs:2:16:
      2 │ import vue from 'npm:@vitejs/plugin-vue'
        ╵                 ~~~~~~~~~~~~~~~~~~~~~~~~

failed to load config from D:\deno-vite-test2\vite.config.mjs
error when starting dev server:
Error: Build failed with 1 error:
vite.config.mjs:2:16: ERROR: [plugin: externalize-deps] EINVAL: invalid argument, stat
    at failureErrorWithLog (file:///D:/deno-vite-test2/node_modules/.deno/[email protected]/node_modules/esbuild/lib/main.js:1566:15)
    at file:///D:/deno-vite-test2/node_modules/.deno/[email protected]/node_modules/esbuild/lib/main.js:1024:28
    at runOnEndCallbacks (file:///D:/deno-vite-test2/node_modules/.deno/[email protected]/node_modules/esbuild/lib/main.js:1438:61)
    at buildResponseToResult (file:///D:/deno-vite-test2/node_modules/.deno/[email protected]/node_modules/esbuild/lib/main.js:1022:7)
    at file:///D:/deno-vite-test2/node_modules/.deno/[email protected]/node_modules/esbuild/lib/main.js:1134:14
    at responseCallbacks.<computed> (file:///D:/deno-vite-test2/node_modules/.deno/[email protected]/node_modules/esbuild/lib/main.js:671:9)
    at handleIncomingPacket (file:///D:/deno-vite-test2/node_modules/.deno/[email protected]/node_modules/esbuild/lib/main.js:726:9)
    at w.readFromStdout (file:///D:/deno-vite-test2/node_modules/.deno/[email protected]/node_modules/esbuild/lib/main.js:647:7)
    at w.emit (https://deno.land/[email protected]/node/_events.mjs:379:28)
    at ot (https://deno.land/[email protected]/node/_stream.mjs:10:32715)

Additional Info

Not sure if this is a bug with create-vite-extra or denos npm implementation etc. I'm happy to create an issue upstream where needed....

@bluwy
Copy link
Owner

bluwy commented Oct 12, 2022

Looks like a regression in Vite 3.1.5, I'll check this out

@bluwy
Copy link
Owner

bluwy commented Oct 12, 2022

I tested this locally and it seems to be working fine. Deno 1.26.1 and macos 12.6. It might be a windows only bug 🤔 Is this happening consistently?

@mathe42
Copy link
Author

mathe42 commented Oct 12, 2022

Yes. tried it a few times. But only with the vue template not with the vanilla template (that works)...

@mathe42
Copy link
Author

mathe42 commented Oct 12, 2022

And running deno run -A --unstable --node-modules-dir npm:[email protected] works with no problem and deno run -A --unstable --node-modules-dir npm:[email protected] fails

@mathe42
Copy link
Author

mathe42 commented Oct 12, 2022

My guess would be that this broke it: vitejs/vite@dc140af

@bluwy
Copy link
Owner

bluwy commented Oct 12, 2022

Yeah but I'm not sure how the PR broke it since tryNodeResolve('npm:@vitejs/plugin-vue') should return undefined, and we would be returning { external: true } like before.

@mathe42
Copy link
Author

mathe42 commented Oct 12, 2022

I have found the location the error is thrown it is
https://github.com/browserify/resolve/blob/main/lib/sync.js#L31

the function gets calld with D:\deno-vite-test2\node_modules\npm:@vitejs\plugin-vue...

@bluwy
Copy link
Owner

bluwy commented Oct 12, 2022

Wow thanks @mathe42 that's really helpful! I suppose Vite would need to skip or interpret npm: for now, looks like Vite is not resolving it right.

@mathe42
Copy link
Author

mathe42 commented Oct 13, 2022

Fixed by vitejs/vite#10446

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