dap-mode
dap-mode copied to clipboard
dap-node setup seems broken
First, thank you to all the contributors for this extension. It has kept me from switching to VS Code.
I am unable to set up dap-node. It seems that the extension downloaded is broken. The logs from the Messages buffer show that the ZIP file is empty, and I confirmed that in my file manager.
dap-node: ms-vscode.node-debug2 debug extension are not set. You can download it with M-x dap-node-setup
Contacting host: marketplace.visualstudio.com:443
uncompressing publicsuffix.txt.gz...done
Wrote /tmp/ext83ZK7l.zip
[/tmp/ext83ZK7l.zip]
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of /tmp/ext83ZK7l.zip or
/tmp/ext83ZK7l.zip.zip, and cannot find /tmp/ext83ZK7l.zip.ZIP, period.
dap-node: Downloading done!
I'm be happy to provide more information if needed.
This is dos protection. Issue should go away after some time.
My dap-chrome-setup, for example, did not work as well after switching to a new laptop and reinstalling everything. It returns nil but the folder is empty. I've had to manually copy the folder from the old pc. Maybe it is related?!
@mihaiolteanu it is related. I fixed it by downloading the extension manually and extracting it in the destination directory.
I got the same issue when running the dap-gdb-lldb-setup command, I tracked it down and it seems that the problem is the generated URL in dap-utils-get-vscode-extension:
https://github.com/emacs-lsp/dap-mode/blob/76cad34de8984f57c2b1e374e9c985cc7ec8dad0/dap-utils.el#L70-L78
For me, the generated URL was: https://marketplace.visualstudio.com/_apis/public/gallery/publishers/webfreak/vsextensions/debug/latest/vspackage), the get(URL) returns either this response:
{"$id":"1","innerException":null,"message":"Request was blocked due to exceeding usage of resource 'Count' in namespace 'AnonymousId'. For more information on why your request was blocked, see the topic \"Rate limits\" on the Microsoft Web site (https://go.microsoft.com/fwlink/?LinkId=823950).","typeName":"Microsoft.TeamFoundation.Framework.Server.RequestBlockedException, Microsoft.TeamFoundation.Framework.Server","typeKey":"RequestBlockedException","errorCode":0,"eventId":3000}
Or this one:
{"$id":"1","innerException":null,"message":"TF400898: An Internal Error Occurred. Activity Id: e15a6fba-431f-4173-9cc3-cc75cfc27a0c.","typeName":"System.NullReferenceException, mscorlib","typeKey":"NullReferenceException","errorCode":0,"eventId":0}
I think the dap-utils-get-vscode-extension needs to be rewritten to emulate a normal download behavior (with some cookies management or something like that).
This issue persists. I came to the same conclusion as @abougouffa by following the broken url. I have updated dap-mode just now and the problem is still there.
@barisere said:
I fixed it by downloading the extension manually and extracting it in the destination directory.
I'm experiencing the same problem... @barisere To which directory are you referring to?
On my machine it's ~/.emacs.d/.extension/vscode/ms-vscode.node-debug2/
On Thu, 5 May 2022, 12:46 Leandro Doctors, @.***> wrote:
@barisere https://github.com/barisere said:
I fixed it by downloading the extension manually and extracting it in the destination directory.
I'm experiencing the same problem... @barisere https://github.com/barisere To which directory are you referring to?
— Reply to this email directly, view it on GitHub https://github.com/emacs-lsp/dap-mode/issues/554#issuecomment-1118456198, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4Z6BBSHOSZSFSBQZ5FLRTVIOYIVANCNFSM5M3PUDUA . You are receiving this because you were mentioned.Message ID: @.***>
@barisere Thanks. I cannot find that directory in my ~/.emacs.d, though...
@allentiak In my machine (I'm using Doom Emacs), the directory for a DAP extension (cpptools for example), is:
~/.emacs.d/.local/etc/dap-extension/vscode/cpptools
To find the destination directory on your machine, try to M-x eval-expression then evaluate the dap-utils-extension-path variable, it should point to the destination directory.
If you cannot install the DAP extension automatically using dap-***-setup commands, you can do it manually:
- First, you need to find the destination directory in your Emacs installation, (
M-x eval-expressionthen typedap-utils-extension-path), - Then you need to go to the extension's page on Visual Studio Marketplace (example for cpptools: marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools).
- From the Marketplace, download the extension for your OS,
- Go to DAP's destination directory, make a directory with the extension name,
mkdir cpptoolsfor cpptools, then extract the downloaded extension inside that directorycd cpptools ; unzip ~/Downloads/ms-vscode.cpptools-1.10.0.vsix - Now, you should be able to use DAP with the installed extension inside Emacs.
@abougouffa Thank you for your quick reply!
- First, you need to find the destination directory in your Emacs installation, (
M-x eval-expressionthen typedap-utils-extension-path),
I tried this, with no avail. Twice, both with and without parenthesis.
In both cases, I got the following:
helm-M-x-execute-command: Symbol’s function definition is void: dap-utils-extension-path
Just in case, I made sure to add the dap package to my init.el. Even then, the package won't show up, either in the installed list, or in the list of packages to install...
Maybe I am missing a package, or something else?
@allentiak Hello,
I see that you are using Spacemacs, I don't know too much about how it loads packages, but I think it won't load the package until you launch a command.
Try to open a project or a buffer, then launch a debug session (on Spacemacs, I think it is SPC d), It can complains about not founding the extension or something like that, but at the end, it should load the package. So after that you can evaluate dap-utils-extension-path variable (you won't need the parenthesis because it is not a function).
@abougouffa Thanks again for your patience.
Actually, that's the first thing I ever tried...
SPC d d d (debug --> debugging --> dap-debug)
Then, I get to choose the configuration template. I choose mine (see code below).
launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "DAP clojurescript",
"url": "http://localhost:3000",
"sourceMaps": true,
"webRoot": "${workspaceFolder}",
"sourceMapPathOverrides": {
"*": "${workspaceFolder}/src/*"
}
}
]
}
First, I get the following error:
user-error: Have you loaded the ‘chrome’ specific dap package
Then, when I try evaluating the symbol, I get the following
helm-M-x-execute-command: Symbol’s value as variable is void: dap-utils-extension-path
The strangest of all is that I get the following in the lsp-log buffer:
Found the following clients for [~/path/to/an/open/test/file.clj] (server-id clojure-lsp, priority 0)
The following clients were selected based on priority: (server-id clojure-lsp, priority 0)
This server does not support foldingRangeProvider
Cancelling codeLens/resolve(157) in hook after-change-functions
Cancelling codeLens/resolve(156) in hook after-change-functions
Cancelling textDocument/codeAction(154) in hook after-change-functions
Cancelling textDocument/codeLens(164) in hook after-change-functions
Cancelling textDocument/codeAction(163) in hook after-change-functions
Cancelling textDocument/hover(330) in hook after-change-functions
Cancelling textDocument/documentHighlight(329) in hook after-change-functions
Cancelling textDocument/codeAction(328) in hook after-change-functions
Cancelling textDocument/codeLens(453) in hook after-change-functions
Cancelling textDocument/documentHighlight(451) in hook after-change-functions
Cancelling textDocument/codeAction(450) in hook after-change-functions
Cancelling textDocument/codeAction(455) in hook after-change-functions
Cancelling textDocument/codeLens(456) in hook after-change-functions
Cancelling textDocument/codeLens(464) in hook after-change-functions
Cancelling textDocument/codeAction(463) in hook after-change-functions
Cancelling textDocument/codeLens(496) in hook after-change-functions
Cancelling textDocument/codeAction(495) in hook after-change-functions
Cancelling textDocument/codeLens(523) in hook after-change-functions
Cancelling textDocument/codeAction(522) in hook after-change-functions
Cancelling textDocument/codeAction(880) in hook post-command-hook
@yyoncho Any ideas about what all this could mean?
@allentiak This page mentions needing (require 'dap-chrome) before you call dap-chrome-setup or do the manual equivalent. I'm assuming that's what
user-error: Have you loaded the ‘chrome’ specific dap package
is trying to tell you.
Adding that to theuser-config section in your .spacemacs file (or whatever it's called) should be enough if that's actually the problem:
(require 'dap-chrome)
Then doing the manual extension installation might work.
@RyanCargan Thanks for your information! Unfortunately, I haven't been able to set this up... I'm opening a bug in Spacemacs that refers to this one.
Going back to the original post (dap-node-setup downloading an empty .zip file), I have a fix.
tl;dr: Here's how to fix the error:
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of /tmp/ext4fqBxX.zip or
/tmp/ext4fqBxX.zip.zip, and cannot find /tmp/ext4fqBxX.zip.ZIP, period.
- Clone (https://github.com/microsoft/vscode-node-debug2)
- Build the visual studio package with
npm install && npm run package, this will output something like./node-debug2-1.43.0.vsix - Unzip that into the relevant location, e.g.
unzip *.vsix -d ~/.emacs.d/.extension/vscode/ms-vscode.node-debug2 - Done, debugging now works.
Why?
it looks like the zip is empty because dap-node-setup tries to download this file:
https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-vscode/vsextensions/node-debug2/latest/vspackage
Which returns an error message, rather than a file
{
"$id": "1",
"innerException": null,
"message": "TF400898: An Internal Error Occurred. Activity Id: 9e6b5206-55c3-449b-b788-488a194ff230.",
"typeName": "System.NullReferenceException, mscorlib",
"typeKey": "NullReferenceException",
"errorCode": 0,
"eventId": 0
}
When I try and search for the package node-debug2, it doesn't seem to exist:
https://marketplace.visualstudio.com/search?term=node-debug2&target=VS&category=All%20categories&vsVersion=&sortBy=Relevance
I found this repo: https://github.com/microsoft/vscode-node-debug2 which says: "This repository has been archived by the owner. It is now read-only. ". Reading through the text it sounds like they now bundle this into vscode, and this library is deprecated? So not sure what the long term fix is.
I did try building the new extension it links to: https://github.com/microsoft/vscode-js-debug/
but that no longer contains nodeDebug.js so doesn't work with dap-node.
UPDATE: The Chrome extension seems to download fine now :-)
(However, nor the Firefox nor the Node ones can be downloaded. Haven't tried the Edge extension,though...)
I can confirm this is broken and not an issue about dos protection.
As @EdwardIII suggest the vscode extension node-debug2 is no longer available and the new one is js-debug-nightly.
Is the solution to this to move dap-node to use js-debug-nightly instead?
@danilevy1212 Yes, see https://github.com/emacs-lsp/dap-mode/issues/369.
In the meantime you can manually build and install node-debug2, as described above: https://github.com/emacs-lsp/dap-mode/issues/554#issuecomment-1171256089.
Thank you!
It should be good after https://github.com/emacs-lsp/dap-mode/pull/700
We should migrate other packages as well (whenever possible).
The URL seems broken again. When I execute M-x dap-node-setup I get the following message: url-http--insert-file-helper: https://open-vsx.org/api/ms-vscode/node-debug2/latest/: Not found. Maybe the definitive solution is to change the elisp command to clone and compile the repository just as @EdwardIII has done above. At least clone and compile when the main download URL fail.
Going back to the original post (
dap-node-setupdownloading an empty .zip file), I have a fix.tl;dr: Here's how to fix the error:
End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive. In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive. unzip: cannot find zipfile directory in one of /tmp/ext4fqBxX.zip or /tmp/ext4fqBxX.zip.zip, and cannot find /tmp/ext4fqBxX.zip.ZIP, period.1. Clone (https://github.com/microsoft/vscode-node-debug2) 2. Build the visual studio package with `npm install && npm run package`, this will output something like `./node-debug2-1.43.0.vsix` 3. Unzip that into the relevant location, e.g. `unzip *.vsix -d ~/.emacs.d/.extension/vscode/ms-vscode.node-debug2` 4. Done, debugging now works.Why?
it looks like the zip is empty because
dap-node-setuptries to download this file:https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-vscode/vsextensions/node-debug2/latest/vspackage
Which returns an error message, rather than a file
{ "$id": "1", "innerException": null, "message": "TF400898: An Internal Error Occurred. Activity Id: 9e6b5206-55c3-449b-b788-488a194ff230.", "typeName": "System.NullReferenceException, mscorlib", "typeKey": "NullReferenceException", "errorCode": 0, "eventId": 0 }When I try and search for the package node-debug2, it doesn't seem to exist:
https://marketplace.visualstudio.com/search?term=node-debug2&target=VS&category=All%20categories&vsVersion=&sortBy=Relevance
I found this repo: https://github.com/microsoft/vscode-node-debug2 which says: "This repository has been archived by the owner. It is now read-only. ". Reading through the text it sounds like they now bundle this into vscode, and this library is deprecated? So not sure what the long term fix is.
I did try building the new extension it links to: https://github.com/microsoft/vscode-js-debug/ but that no longer contains nodeDebug.js so doesn't work with
dap-node.
@lvguedes Assumming you cannot reopen this issue, I would suggest opening a new issue for this.
EDIT: It's now merged
Can you try the fix from here? https://github.com/emacs-lsp/dap-mode/pull/762
Just set the custom variable dap-utils-openvsx-extension-api-url to "https://open-vsx.org/api/%s/%s/%s" (no slash at end).
You can do it through just changing the value of the custom variable - no need to download the PR branch.