Closed itajaja closed 4 years ago
you can upgrade
Same here...
Deno output:
Found deno, version:
deno: 1.0.2
v8: 8.4.300
typescript: 3.9.2
Deno is not found
you can upgrade
no, I am already using the latest version of the right plugin, not the deprecated one
I had the same issue and it looks like when I install the extension from vs marketplace the typescript-deno-plugin
version running is v1.29.0 😕
I've pulled the repo and build it locally then I've installed the .vsix manually and now it's working and it's running typescript-deno-plugin v1.31.0
. Not ideal but it's working (at least for me 😛)
Yes, this happens to me too, the denoland plugin doesn't work at all while the deprecated justjavac does.
I encounter this issue on the latest VSCode 1.45.1 on Mac. And I just figured out and resolve the problem by upgrade the global tsc to latest 3.9.3 and config VSCode to use that version with "typescript.tsdk".
I guess that was due to the VSCode inline tsc 3.8.3 didn't work well with deno's plugin, while deno's inline one is 3.9.2.
Checkout this link https://code.visualstudio.com/docs/typescript/typescript-compiling#_using-newer-typescript-versions for the steps.
I'm using latest VSCode Insider which also uses latest Typescript 3.9.4, and the denoland version of the extension doesn't work anyway (No import and no Deno namespace, but deno in the status bar). Both deprecated versions of the extension works (justjavac and axetroy).
Maybe this answer is helpful, configuring Deno types in VS Code.
Currently, this is a working solution for me with the built-in TypeScript version of VS Code 1.45.1
. If you need to configure a custom workspace version, there are some more steps to do - take a look at the docs here.
I am seeing this issue too. I tried all the above solutions to no avail. I don't imagine this is intended behavior.
you can upgrade
I think a number of people misunderstood this comment. It turns out the deprecated deno plugin by justjavac actually has a newer release than the official plugin (this one) - it worked for me.
you can upgrade
I think a number of people misunderstood this comment. It turns out the deprecated deno plugin by justjavac actually has a newer release than the official plugin (this one) - it worked for me.
Not sure I would say that the comment was misunderstood. Seems pretty clear and it should probably be changed? Regardless, this solution worked for me as well
nope, I have the new one, still deno doesn't work:
@itajaja , That's the problem, the "new" one is old (1.24.0), and the deprecated is newer (1.34.0). In other words, the extension from denoland doesn't work yet, but the extension from justjavac does, but you'll get a annoying deprecation popup on startup.
I see, thanks for the clarification. well, since this is still the repo for the "new" one, the new one still has this bug that needs to be solved
@itajaja , That's the problem, the "new" one is old (1.24.0), and the deprecated is newer (1.34.0). In other words, the extension from denoland doesn't work yet, but the extension from justjavac does, but you'll get a annoying deprecation popup on startup.
So is there an expected timeline for the official plugin to issue an update?
reverting to the deprecated plugin until this issue is resolved
Note that you may have to reinstall the extension to get this fix (I did, even though I newly installed it).
Im facing the same issue. i installed latest Deno 1.4.6 version and denoland.vscode-deno extension. What is solution to this error??
@rshashik restart your ide - what have you tried so far?
@rshashik restart your ide - what have you tried so far?
1) installed deno 1.4.6 2) installed denon v2.4.4 3) installed denoland.vscode-deno extension in my mac 4) created .vscode/settings.json file and set "deno.enable": true 5) created server.ts file `import { Application } from "https://deno.land/x/oak/mod.ts"; import router from "./routes.ts"; const port = Deno.env.get("PORT") || 5000;
const app = new Application();
app.use(router.routes()); app.use(router.allowedMethods());
console.log(Server running on port ${port}
);
await app.listen({ port: +port });`
Error in my vscode editor at Deno.env.get("PORT"): Cannot find name 'Deno'.ts(2304) https://github.com/rshashik/pdr.git
@rshashik did you restart your IDE? Can you check the extension is enabled? Can you check it’s the correct link (click the link in the readme)?
@rshashik
are you sure your settings.json
is valid?
for me it works, same versions as you + .vscode/settings.json
:
{ "deno.enable": true }
after - restart IDE and it works (for me)
I'm also encountering this issue.
I can see that the deno extension is doing something, since as soon as I set it to "deno.enable": false
in my settings.json I get the An import path cannot end with a '.ts' extension. Consider importing [...] .ts(2691)
But when I set "deno.enable": true
those import errors disappear but I still have Cannot find name 'Deno'
. Types seems to default to any
everywhere, and development is a pain.
The very odd thing is that, sometime, and I've not been able to figure exactly how, through a combination of activating / deactivating the extension, changing code in my project, restarting the TS server, restarting the deno language server, it starts to work properly…
But whenever I leave vscode and come back to the project, its broken again :(
I've tried disabling most of my vscode extensions without success… The issue is there for me, and I think it's a nasty one to figure out if some people never experience it :/
Same issue as in the OP, plus it doesn't pick up on cached modules.
deno info some_file.ts
correctly reports cached dependencies and their respective dependency trees. The scripts also run/bundle/install just as expected.
Deno.something(...)
reports Cannot find name 'Deno'.ts(2304)
and
import { some_module } from 'some_url';
reports Could not find module "some_url" locally.Deno Language Server(1005)
Environment (An ubuntu vm basically set up from scratch just to test deno out): -Fresh ubuntu 20.04.1 installation. -Fresh VSCode 1.15.1 -Fresh deno installation 1.4.6 -Deno extension 2.3.3
.vscode/settings.json:
{
"deno.enable": true,
"deno.unstable": false,
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
}
The extension is enabled in VSCode. The deprecated version (justjavac.vscode-deno) does not show the behavior for Deno.something
but fails to pick up on the cached modules too.
If you still have errors like Cannot find name 'Deno'. ts(2304)
, try the following:
View > Command Palette... > deno: Init > Enable deno lint? Yes
Deno is now set up. You can enable and disable settings (like
--unstable
) in the.vscode/settings.json
file. Before the extension will work you need to reload VS Code.
Click on Reload window
vscode/settings.json
will contain:
{
"deno.enable": true,
"deno.lint": true,
"deno.unstable": true
}
If you still have errors like Could not find module "https://deno.land/..." locally. Deno Language Server(1005)
, try the following:
View > Command Palette... > deno: Restart Deno Language Server
Thanks for the answer. Following the instructions, the second half worked great and vscode now correctly reports the modules as known. Unfortunately it is still unaware of the Deno
namespace and reports the familiar error. I recorded the steps, just in case, and you can look at the behavior here: https://streamable.com/cz2fkl
Another thing of note is that in tsconfig.json
{
"compilerOptions": {
"experimentalDecorators": true,
"rootDirs": [
"./src",
"./tests"
]
}
}
vscode reports
File '$HOME/.cache/deno/lib.deno.unstable.d.ts' not found.ts
which probably is a more suitable hint at the cause here.
@nitowa: are you sure Deno
is correctly installed ?
$ deno info
DENO_DIR location: "$HOME/.deno"
Remote modules cache: "$HOME/.deno/deps"
TypeScript compiler cache: "$HOME/.deno/gen"
lib.deno.unstable.d.ts
should be found in $HOME/.deno
, not in $HOME/.cache/deno
.
Deno <version>
should be showed at lower right of VSCode status bar eg TypeScript 4.1.2 Deno 1.5.4
.
Check your $DENO_DIR
envvar which should be set to $HOME/.deno
BTW, in your video, there is an Unexpected end of JSON input
error, probably in tsconfig.json
.
HTH, Pierre
The project I'm testing with is pretty much https://github.com/lampewebdev/deno-boilerplate unmodified. Not sure where the unexpected end of JSON came from, but tsconfig.json just reports the error from the previous post (and fwiw is valid json).
deno info
yields
DENO_DIR location: "$HOME/snap/deno/15/.cache/deno"
Remote modules cache: "$HOME/snap/deno/15/.cache/deno/deps"
TypeScript compiler cache: "$HOME/snap/deno/15/.cache/deno/gen"
which deno
/snap/bin/deno
deno -V
deno 1.4.6
$DENO_DIR
was in fact not set at all, but even after manually setting it, the error persists. Deno was installed via snap
Deno
(without version) in status bar indicates that deno executable cannot be found in path.
Otherwise, Deno <version>
is displayed in status bar.
DENO-DIR
is used to locate both lib.deno.d.ts
and lib.deno.unstable.d.ts
files.
At start, those files will be created automatically.
If Cannot find name 'Deno'. ts(2304)
error persists, restart VSCode window.
If you still have errors like
Cannot find name 'Deno'. ts(2304)
, try the following:
View > Command Palette... > deno: Init > Enable deno lint? Yes
Deno is now set up. You can enable and disable settings (like
--unstable
) in the.vscode/settings.json
file. Before the extension will work you need to reload VS Code.Click on
Reload window
vscode/settings.json
will contain:{ "deno.enable": true, "deno.lint": true, "deno.unstable": true }
If you still have errors like
Could not find module "https://deno.land/..." locally. Deno Language Server(1005)
, try the following:
View > Command Palette... > deno: Restart Deno Language Server
It works for me fine. Thank you!
i had the same issue what worked for me was to press Ctrl+Shit+p in VS Code then Type Deno in the search. And click Deno Initialize workspace
I did Ctrl+Shift+P -> Initialize Workspace Configuration, which created me .vscode/settings.json
:
{
"deno.enable": true,
"deno.lint": true,
"deno.unstable": false
}
But still the problem occurs:
vscode-deno: v3.7.0 deno 1.11.5 (release, x86_64-pc-windows-msvc) v8 9.1.269.35 typescript 4.3.2
UPD. I created a new issue here: https://github.com/denoland/vscode_deno/issues/466
i had the same issue what worked for me was to press Ctrl+Shit+p in VS Code then Type Deno in the search. And click Deno Initialize workspace
This worked for me, after 2 hours of searching for a solution. Deno needs to get their extension in order... 🙄
i had the same issue what worked for me was to press Ctrl+Shit+p in VS Code then Type Deno in the search. And click Deno Initialize workspace
This worked for me, after 2 hours of searching for a solution. Deno needs to get their extension in order... 🙄
The welcome page and instructions make it clear the this needs to be done, as very few people have every TypeScript project be a Deno one. Is there some way we could make these instructions clearer in order to "sort our extension out"?
I encountered this issue as well today.
For me the following two steps fixed it:
Also running step 2 was the missing step for me.
I encountered this issue as well today.
For me the following two steps fixed it:
- press Ctrl+Shift+p and choose 'Deno: Initialize Workspace' to initialize the workspace.
- press Ctrl+Shift+p and choose 'Deno: Restart Language Server'.
Also running step 2 was the missing step for me.
Thanks but this doesn't help in my case 😔 It seems there are various reasons why this might happen. In my case it's likely has something to do with OS Windows, but can't say for sure. For those who tried all the hints from here and nothing works, I recommend to proceed / add your details in this new issue, to help investigate the problem: #466
If you are using a custom tsconfig.json
with Deno and getting this message, the solution is to add "deno.ns"
to lib
:
"compilerOptions": {
"lib": [
"esnext",
"dom",
"deno.ns"
]
If you are using a custom
tsconfig.json
with Deno and getting this message, the solution is to add"deno.ns"
tolib
:"compilerOptions": { "lib": [ "esnext", "dom", "deno.ns" ]
I was having the same issue, and this is what actually finally solved it for me. Thank you!
1- Install this extension : here. 2- Ctrl+Shift+P in your working directory. 3- Write this: Deno: Initialize Workspace Configuration. 4- Yes. 5- Yes.
Your welcome.
why is it so hard to get deno setup going yikes
If you are using a custom
tsconfig.json
with Deno and getting this message, the solution is to add"deno.ns"
tolib
:"compilerOptions": { "lib": [ "esnext", "dom", "deno.ns" ]
You are the true MVP. Everyone else be going in circles. "Do X. X didn't work. Do X. X didn't work. repeat"
Seeing a lot of people get tripped up on the deno.ns
I opened denoland/deno#15222 which would at least try to provide better information on how to resolve the issue.
I had this issue, which was caused by this line in my VS Code settings.json
:
"typescript.tsserver.experimental.enableProjectDiagnostics": true
I diagnosed this by starting VS Code with a blank profile (code --user-data-dir=/tmp/vscode .
) and seeing that Deno support worked, so I removed lines from my VS Code config until I found the culprit.
This also fixed the error An import path cannot end with a '.ts' extension.
.
In case it helps anyone else: I had this issue because I disabled the built-in TypeScript and JavaScript Language Features plugin in vscode to use the volar plugin's takeover mode for VueJS development.
Searching @builtin TypeScript
and then enabling the TypeScript and JavaScript Language Features
plugin solved the issue for me.
Had the same issue, resolved it by enabling Deno Language Server.
Open settings (⌘ + . / Ctrl + .) and search for Deno:enable and active it either for the workspace or user profile.
I solved this issue by installing and enabling the Deno plugin on VS Code
deno 1.30.2 (release, aarch64-apple-darwin)
v8 10.9.194.5
typescript 4.9.4
Does it really work?
.vscode/settings.json
{
"deno.enable": true,
"deno.lint": true,
"editor.formatOnSave": true,
"[typescript]": {
"editor.defaultFormatter": "denoland.vscode-deno"
}
}
Does it really work?
.vscode/settings.json
{ "deno.enable": true, "deno.lint": true, "editor.formatOnSave": true, "[typescript]": { "editor.defaultFormatter": "denoland.vscode-deno" } }
Do you have an import map that maps constructs
to a fully qualified URL?
imports seem to work correctly, deno seems to be running:
I didn't change any settings. what am I missing?