Comments (29)
@gavin-ts , @alixander , thank you. 0.8.6 works.
from d2-vscode.
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.
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.
it works!
from d2-vscode.
@gavin-ts 0.8.5 still does not work the same as 0.8.4 (URL path must be absolute).
from d2-vscode.
@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.
Excellent, now I have something to go on! I'll see if my current hunch is correct. Thanks!
from d2-vscode.
Might be related to this
https://github.com/sindresorhus/open/blob/accd304abffaec9016f180496d4d3de40145b3c9/index.js#L14
from d2-vscode.
great. thanks @BarryNolte !
from d2-vscode.
related: #73
from d2-vscode.
I can't reproduce this issue on my machine, are you able to reproduce this on windows @BarryNolte ?
from d2-vscode.
@imding if you use vscode menubar Help
->Toggle Developer Tools
do you see any error messages in the console?
from d2-vscode.
@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.
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.
@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.
@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.
This looks like a similar issue: microsoft/vscode-go#1386 (comment)
from d2-vscode.
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.
ok we can see if it is fixed in 0.8.5
from d2-vscode.
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.
did 0.8.4 work on linux for you as well? @quixoticaxis
from d2-vscode.
It all works on my win10 machine, so win11 related?
from d2-vscode.
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.
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.
The noted fix worked for me too
from d2-vscode.
thanks everyone version 0.8.6 is released and should fix this issue
from d2-vscode.
we'll close this once someone can confirm. @Rhywun @therastal @vittee @quixoticaxis @imding
from d2-vscode.
Same for me!
Great work. Thanks
from d2-vscode.
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)
- layers/steps keywords
- Extension checks for `d2` executable every time VS Code starts.
- syntax highlighting bug with unclosed bracket in code HOT 3
- vsc preview error HOT 2
- do not force color theme on extension activation. HOT 6
- Update Timer parameter doesn't apply to Markdown files HOT 3
- spread substitutions
- support layers HOT 4
- substitutions syntax highlight err
- Support syntax highlighting in markdown documents. HOT 2
- Allow for setting Layout, Theme and Sketch options per document HOT 4
- Opt-in footnotes in svg and connection tooltips HOT 1
- Remove `import` as a keyword HOT 1
- Horizontal scrolling issue in Preview mode HOT 2
- rendered href links to local .md files do not work HOT 2
- Need to fix dependabot alerts
- Couple of non-fatal warnings when trying to add this language to GitHub Linguist HOT 7
- Dark theme option for preview theme
- Create a plugin for Jetbrains HOT 1
- import syntax
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from d2-vscode.