When I try to run deno.land server example code:
import { serve } from "https://deno.land/[email protected]/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.
Reproducible on Linux with Deno v1.0.3. The same example works with Deno v1.0.2.
This regressed with ad6d2a7734aafb4a64837abc6abd1d1d0fb20017 (determined with git bisect).
I forget to mention I am on windows 10, deno v1.0.3
I had the same problem a few minutes again, .ts would work, but not .js.
However, looks like even the .js works now.. Someone fixed already ?
deno run --allow-net helloWorld.ts
or
deno run --allow-net helloWorld.js
both works.
Thanks much & stay safe !
This error is caused by the fact that pre 1.0.3 TS compiler was created on demand for each encountered .ts import - even when such import occurred in .js file. In 1.0.3 compilation is can only be performed upfront and this case wasn't covered.
Question is: is importing .ts file from .js file a valid import? If so, fixing this problem should be rather easy by spinning TS compiler if any of the dependencies in module graph is a TS file (in addition to current logic that uses checkJs compiler setting to type check .js files).
@kitsonk @ry WDYT?
Question is: is importing
.tsfile from.jsfile a valid import?
Incrementally converting a project from JS to TS would be tough if not. I think unsafe code should be able to call safe code.
Question is: is importing
.tsfile from.jsfile a valid import?Incrementally converting a project from JS to TS would be tough if not. I think unsafe code should be able to call safe code.
Yeah, good argument.
@sandeepgokhale If you add new import (that you never have before) to your helloWorld.js and try to run it then you should get error.
When you compile .ts and then .js everything is working. Problem is when you do some new stuff on .js without .ts compilation. (At least that's my guessing)
can i go back to previous version to fix this issue?
This error should be fixed in the latest release (1.0.4)
when i use denodb package, i still encounter this error,
The system cannot find the path specified. (os error 3)
@lucacasonato Unfortunately it is not.
I check it on two PC with windows 10.
Now when I run helloWorld.js I have this error:
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)
Yes, still an issue on 1.0.5. Repro:
temp.js:
import "https://deno.land/[email protected]/examples/welcome.ts";
Download https://deno.land/[email protected]/examples/welcome.ts
Compile file:///mnt/c/Users/Nayeem/projects/deno/temp.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:///mnt/c/Users/Nayeem/projects/deno/__anonymous__:1:1
md5-5d7f83f838c8a6a303e7734fda715e22
Download https://deno.land/[email protected]/examples/welcome.ts
Compile file:///mnt/c/Users/Nayeem/projects/deno/temp2.js
error: No such file or directory (os error 2)
```
Same result if I used TS here.
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/[email protected]/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
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 also have this issue. How to fix it?
The fix was released in Deno v1.1.0. Please upgrade and let us know if problem persists.
Most helpful comment
I have exactly the same error from today that I went from version 1.0.3 to 1.0.5