I cant install deno by running this command: curl -fsSL https://deno.land/install.sh | sh

No description
Leokuma
Leokuma15d ago
What's the problem?
Bloxs
Bloxs15d ago
Deno installed properly, you probably didn’t add the 2 export lines to your .bashrc or similar and thus think that deno didn’t install since the command doesn’t work
saba
saba14d ago
I can't work with deno I will paste my code here, down below import { serve } from "https://deno.land/std/http/server.ts"; // setup server const server = serve({ port: 3000 }); console.log('http://localhost:3000/'); for await (const req of server) { // serve index page if (req.url === '/') { req.respond({ status: 200, body: await Deno.open('./public/index.html') }) } }
krml
krml13d ago
So what’s the error you get?
DNA
DNA6d ago
Your problem is not deno itself. It's your code. The error explains it pretty well:
Listening on http://localhost:8000/
http://localhost:3000/
error: Uncaught (in promise) TypeError: server is not async iterable
for await (const req of server) {
^
at file:///E:/img-view/saba.ts:7:25
Listening on http://localhost:8000/
http://localhost:3000/
error: Uncaught (in promise) TypeError: server is not async iterable
for await (const req of server) {
^
at file:///E:/img-view/saba.ts:7:25
Generally, I would use Deno.serve instead of the function you use, because it's deprecated (see screenshot below). Then, your code would look like this:
Deno.serve({port: 3000}, (req: Request) => {
if (req.url === "/") return new Response(Deno.readTextFileSync("./public/index.html"), {status: 200});
else return new Response("Not Found", {status: 404});
});
Deno.serve({port: 3000}, (req: Request) => {
if (req.url === "/") return new Response(Deno.readTextFileSync("./public/index.html"), {status: 200});
else return new Response("Not Found", {status: 404});
});
DNA
DNA6d ago
No description
More Posts
PHP to Javscript little code```php if ($_SERVER["REQUEST_METHOD"] == "POST") { if (isset($_FILES["file"])) { $file= $_FSpeechRecognition is not foundThere are other SpeechRecognition interfaces, but the main one isn't available.Ignoring `deno(redirect)` in vscode?When deno extension in vscode is enabled, i get this warning, that my imported file was redirected. Adding a max runtime timeout to Deno JS executionAs the title states, I would like to be able to add a timeout to any JS code that I am executing in Do you know how I can call a C variadic function in FFI Deno?I want to call a C variadic function from Deno but I looked at the documentation and it doesn't seemKV watch prefix?Is there a way to watch a prefix. I would like to be able to watch for any record added to a specifDeno LSP Issue with import maps?I've been using an import map throughout my project like this: deno.json file at the projects' root Using `Deno.FsFile.prototype.readable` with `Response`I was trying to stream a file into a response with the snippet: ```ts const file = await Deno.open(preact-helmet-async missing HelmetProvider exportI'm on the canary version testing out jsxImportSourceTypes and ran into an issue when switching to uWhere has std/hash/sha3.ts gone?Basically what the title says. This was removed from std/ at some point, but I can't find the currenLoading a module with `.load_main_es_module_from_code()` and TS module loader doesn't transpileWhile working on a script runtime I ran into a curious issue where the main module I load doesn't geStaticModuleLoader: why must the ModuleSpecifier be a URL?hey everyone, I'm trying to pass a `StaticModuleLoader` to my runtime to enable specific imports. EaWriting CSS in FreshAre there any alternatives in how we write CSS other than Tailwind-like (inline & abbreviated)? I pPassing C enum to function and read in TypeScriptFirst of all I am not a trained software developper, so please forgive me if I am missing some basicintergrating Flowbite with freshI want to intergrate Flowbite with Fresh. Any idea on the best way to go about this? And will I be lget file path from FsFilegiven a `Deno.FsFile`, is there a way to get its path (or at least a filename)? i can't really see bulr to rtransparent gradientI am working on reactjs project in the project it should have blur to transperant bg take a look at Streaming video from browser to deno serverTrying to stream video from Chrome to my local Deno server but having trouble understanding how to p