SabaMazmishvili
SabaMazmishvili8mo ago

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

No description
7 Replies
Leokuma
Leokuma8mo ago
What's the problem?
Bloxs
Bloxs8mo 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
SabaMazmishvili
SabaMazmishviliOP8mo 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
krml8mo ago
So what’s the error you get?
DNA
DNA8mo 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
DNA8mo ago
No description
mindon
mindon4mo ago
curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number curl -v https://deno.land error as above curl -sI https://deno.land -o/dev/null -w '%{http_version}\n' output 0

Did you find this page helpful?