deno: Deno error pure js file

When I try to run deno.land server example code:

import { serve } from "https://deno.land/std@0.54.0/http/server.ts"; const s = serve({ port: 8000 }); console.log("http://localhost:8000/"); for await (const req of s) { req.respond({ body: "Hello World\n" }); }

but as JavaScript file (deno run --allow-net server.js) I get error:

[Error 3] The system cannot find the path specified

Only when I run it as .ts and then again as .js it work.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (6 by maintainers)

Most upvoted comments

I have exactly the same error from today that I went from version 1.0.3 to 1.0.5

Update: I’m looking into this issue and found root cause. Fix will be released in Deno 1.1 in a few days.

I am running into this issue today, some details bellow:

On MacOS 10.5.4, here are my files:

deps.js

export { Application } from "https://deno.land/x/oak@v5.0.0/mod.ts";

mod.js

import { Application } from "./deps.js";

const app = new Application();

app.use((ctx) => {
  ctx.response.body = "Hello World!";
});

await app.listen({ port: 8000 });

Running with the command:

deno run --allow-net mod.js

Console error:

Compile file:///Users/dio/dev/test/mod.js
error: No such file or directory (os error 2)

My current Deno setup:

deno: 1.0.5 v8: 8.4.300 typescript: 3.9.2

Happening since I’ve start testing a deps file on Deno 1.0.4

Edit: If I try to change the deps.js file to deps.ts, the error changes to:

Compile file:///Users/dio/dev/test/mod.js
error: Uncaught AssertionError: Unexpected skip of the emit.
    at Object.assert ($deno$/util.ts:33:11)
    at compile ($deno$/compiler.ts:1170:7)
    at tsCompilerOnMessage ($deno$/compiler.ts:1338:22)
    at workerMessageRecvCallback ($deno$/runtime_worker.ts:72:33)
    at file:///Users/dio/dev/test/__anonymous__:1:1