Deno: Failed to find files when import ts files in js (Ubuntu)

Created on 4 Jul 2020  路  3Comments  路  Source: denoland/deno

OS: Ubuntu 20.04 LTS

Related issues:

Denjucks: https://github.com/denjucks/denjucks/issues/9
View-engine: https://github.com/deligenius/view-engine/issues/11

Code1 denjucks:

// @deno-types="https://deno.land/x/denjucks/mod.d.ts"
import denjucks from "https://deno.land/x/denjucks/mod.js";

console.log(
    denjucks.renderString("hello {{ txt }}", {txt: "world"})
);

Code2 view-engine:

// /app.ts
import { Application } from "https://deno.land/x/oak/mod.ts";
import {
  viewEngine,
  engineFactory,
  adapterFactory,
} from "https://deno.land/x/view_engine/mod.ts";

const ejsEngine = engineFactory.getEjsEngine();
const oakAdapter = adapterFactory.getOakAdapter();

const app = new Application();

app.use(viewEngine(oakAdapter, ejsEngine));

app.use(async (ctx, next) => {
  ctx.render("index.ejs", { data: { name: "John" } });
});

await app.listen({ port: 8000 });
<!--./index.ejs-->
<body>
  <h1><%=data.name%></h1>
</body>

Error

Both Code1 and Code2 have the same error:

error: Failed to get compiled source code of https://deno.land/[email protected]/path/mod.ts.
Reason: No such file or directory (os error 2)

Observation

denjucks is written in JS, and view-engine includes a port version of ejs, which is also written in JS. As the error is related to the import of path module, so I've checked the source code of denjucks and view-engine. However, all the path imports are being used by JS files.

Here is where I found all the path imports:

Denjucks case

the import includes path:

is being used by

View-engine case

the import includes path:

is being used by

Conclusion

  • Deno fails to find files when import ts in js files.
  • Only happens in Ubuntu (test passed in Windows 10 and macOS)
bug cli

Most helpful comment

This issue should be resolved by #6760 which will be released in the next few days.

All 3 comments

This issue is sadly present on Windows 10 Pro, Deno 1.1.2 and 1.1.3 as well, not only on Ubuntu.

I got this error while building my docker image with hayd/alpine-deno:latest:

Failed to get compiled source code of https://deno.land/[email protected]/path/mod.ts.
Reason: No such file or directory (os error 2)

I confirmed that there is no issue on macOS.

Any update related to solution?

This issue should be resolved by #6760 which will be released in the next few days.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

metakeule picture metakeule  路  3Comments

davidbarratt picture davidbarratt  路  3Comments

somombo picture somombo  路  3Comments

xueqingxiao picture xueqingxiao  路  3Comments

CruxCv picture CruxCv  路  3Comments