Giter Site home page Giter Site logo

Comments (29)

quixoticaxis avatar quixoticaxis commented on May 26, 2024 4

@gavin-ts , @alixander , thank you. 0.8.6 works.

from d2-vscode.

BarryNolte avatar BarryNolte commented on May 26, 2024 3

It's the open module that I added to open links in the preview window trying get the path to the 'xdg-open' script for linux, on a windows machine. This module had a note about not really working in electron apps, so I guess this is the subtle hint to not use it. Going off to find alternatives...

from d2-vscode.

vittee avatar vittee commented on May 26, 2024 2

The error is originated from this file:
C:\Users\vittee\.vscode\extensions\terrastruct.d2-0.8.5\dist\extension.js

And I found that it contains a literal string pointing to an invalid path (on Windows)

const $e = i.dirname((0, s.fileURLToPath)("file:///Users/gavinnishizawa/github_repos/d2-vscode/node_modules/open/index.js"))

Simply edit that string to:

const $e = i.dirname((0, s.fileURLToPath)("file://./node_modules/open/index.js"))

And it now works

from d2-vscode.

imding avatar imding commented on May 26, 2024 2

it works!

from d2-vscode.

quixoticaxis avatar quixoticaxis commented on May 26, 2024 1

@gavin-ts 0.8.5 still does not work the same as 0.8.4 (URL path must be absolute).

from d2-vscode.

quixoticaxis avatar quixoticaxis commented on May 26, 2024 1

@alixander 0.8.3, 0.8.4, and 0.8.5 work on my Kubuntu (latest stable).
Only 0.8.3 works on my Windows 11 PC.

from d2-vscode.

BarryNolte avatar BarryNolte commented on May 26, 2024 1

Excellent, now I have something to go on! I'll see if my current hunch is correct. Thanks!

from d2-vscode.

vittee avatar vittee commented on May 26, 2024 1

Might be related to this

https://github.com/sindresorhus/open/blob/accd304abffaec9016f180496d4d3de40145b3c9/index.js#L14

from d2-vscode.

alixander avatar alixander commented on May 26, 2024 1

great. thanks @BarryNolte !

from d2-vscode.

alixander avatar alixander commented on May 26, 2024

related: #73

from d2-vscode.

gavin-ts avatar gavin-ts commented on May 26, 2024

I can't reproduce this issue on my machine, are you able to reproduce this on windows @BarryNolte ?

from d2-vscode.

gavin-ts avatar gavin-ts commented on May 26, 2024

@imding if you use vscode menubar Help->Toggle Developer Tools do you see any error messages in the console?

from d2-vscode.

BarryNolte avatar BarryNolte commented on May 26, 2024

@gavin-ts I'm not seeing anything. I built the vsix based on master and installed it, no obvious problems on Windows or Linux. I brought up dev tools and didn't see anything there either. Next bit of troubleshooting is, what extensions are installed (@imding . @quixoticaxis)? And what version of vscode, there was just an update.

from d2-vscode.

quixoticaxis avatar quixoticaxis commented on May 26, 2024

I'm using the latest Windows VSCode version (1.77.1).
Dev tools show the following line: mainThreadExtensionService.ts:112 Activating extension 'Terrastruct.d2' failed: File URL path must be absolute.

from d2-vscode.

gavin-ts avatar gavin-ts commented on May 26, 2024

@BarryNolte I wonder if it is related to the esmoduleinterop change, and if this could fix it: 15d75d6 . but until we can reproduce the issue we won't be able to confirm the fix.
I was looking at the changes between master and 57d6782 and this seems like an option

from d2-vscode.

BarryNolte avatar BarryNolte commented on May 26, 2024

@gavin-ts This seems to be a likely culprit. The only time I've had extensions fail to load, it's something like an imported module failing to load.

from d2-vscode.

gavin-ts avatar gavin-ts commented on May 26, 2024

This looks like a similar issue: microsoft/vscode-go#1386 (comment)

from d2-vscode.

BarryNolte avatar BarryNolte commented on May 26, 2024

Maybe, but given the bug is 5 years old, I don't know. How about we try the change you made, and if it still works in our machines, at least we know it wasn't made worse.

from d2-vscode.

gavin-ts avatar gavin-ts commented on May 26, 2024

ok we can see if it is fixed in 0.8.5

from d2-vscode.

quixoticaxis avatar quixoticaxis commented on May 26, 2024

Extension works on Linux for me, so something is probably OS related.

I'm currently on Windows 11 (10.0.22621.1485).

from d2-vscode.

alixander avatar alixander commented on May 26, 2024

did 0.8.4 work on linux for you as well? @quixoticaxis

from d2-vscode.

BarryNolte avatar BarryNolte commented on May 26, 2024

It all works on my win10 machine, so win11 related?

from d2-vscode.

quixoticaxis avatar quixoticaxis commented on May 26, 2024

Disclaimer: I know literally zero javascript.
Debugging the isnstalled extension (running debugger from %userprofile%\.vscode\extensions\terrastruct.d2-0.8.5 folder) gave me the following callstack:

Exception has occurred: TypeError: File URL path must be absolute
t new NodeError (node:internal/errors:371:5)
	at getPathFromURLWin32 (node:internal/url:1390:11)
	at fileURLToPath (node:internal/url:1420:22)
	at 2163 (&userprofile%\.vscode\extensions\terrastruct.d2-0.8.5\dist\extension.js:1:85043)
	at r (&userprofile%\.vscode\extensions\terrastruct.d2-0.8.5\dist\extension.js:1:90391)
	at 6662 (&userprofile%\.vscode\extensions\terrastruct.d2-0.8.5\dist\extension.js:1:51580)
	at r (&userprofile%\.vscode\extensions\terrastruct.d2-0.8.5\dist\extension.js:1:90391)
	at 3961 (&userprofile%\.vscode\extensions\terrastruct.d2-0.8.5\dist\extension.js:1:53416)
	at r (&userprofile%\.vscode\extensions\terrastruct.d2-0.8.5\dist\extension.js:1:90391)
	at 112 (&userprofile%\.vscode\extensions\terrastruct.d2-0.8.5\dist\extension.js:1:54771)
	at r (&userprofile%\.vscode\extensions\terrastruct.d2-0.8.5\dist\extension.js:1:90391)
	at &userprofile%\.vscode\extensions\terrastruct.d2-0.8.5\dist\extension.js:1:90808
	at Object.<anonymous> (&userprofile%\.vscode\extensions\terrastruct.d2-0.8.5\dist\extension.js:1:90833)
	at Module._compile (node:internal/modules/cjs/loader:1165:14)
	at Module._extensions..js (node:internal/modules/cjs/loader:1220:10)
	at Module.load (node:internal/modules/cjs/loader:1035:32)
	at Module._load (node:internal/modules/cjs/loader:876:12)
	at c._load (node:electron/js2c/asar_bundle:5:13343)
	at m._load (%letscallitprogramfiles%\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:124:14199)
	at h._load (%letscallitprogramfiles%\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:119:11871)
	at I._load (%letscallitprogramfiles%\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:119:11264)
	at Module.require (node:internal/modules/cjs/loader:1059:19)
	at require (node:internal/modules/cjs/helpers:102:18)
	at Function.i [as __$__nodeRequire] (%letscallitprogramfiles%\Microsoft VS Code\resources\app\out\vs\loader.js:5:98)
	at E.rb (%letscallitprogramfiles%\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:119:13135)
	at async Promise.all (index 0)

Hope it helps.

from d2-vscode.

therastal avatar therastal commented on May 26, 2024

The error is originated from this file: C:\Users\vittee\.vscode\extensions\terrastruct.d2-0.8.5\dist\extension.js

And I found that it contains a literal string pointing to an invalid path (on Windows)

const $e = i.dirname((0, s.fileURLToPath)("file:///Users/gavinnishizawa/github_repos/d2-vscode/node_modules/open/index.js"))

Simply edit that string to:

const $e = i.dirname((0, s.fileURLToPath)("file://./node_modules/open/index.js"))

And it now works

This fixed it for me! 👍

from d2-vscode.

Rhywun avatar Rhywun commented on May 26, 2024

The noted fix worked for me too

from d2-vscode.

gavin-ts avatar gavin-ts commented on May 26, 2024

thanks everyone version 0.8.6 is released and should fix this issue

from d2-vscode.

alixander avatar alixander commented on May 26, 2024

we'll close this once someone can confirm. @Rhywun @therastal @vittee @quixoticaxis @imding

from d2-vscode.

jfudickar avatar jfudickar commented on May 26, 2024

Same for me!
Great work. Thanks

from d2-vscode.

imding avatar imding commented on May 26, 2024

sorry for completely dropping out on the thread.

I only had this issue on windows, will check asap, and thanks so much for fixing it!!

from d2-vscode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.