Deno: error: No such file or directory (os error 2)

Created on 2 Jun 2020  ·  46Comments  ·  Source: denoland/deno

Running a simple oak server to illustrate deno-react-example using deno 1.0.3 on Ubuntu results in: "error: No such file or directory (os error 2)"

Would anyone know how to debug this?
Thanks

bug cli

Most helpful comment

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

All 46 comments

I've just spent the last couple of hours debugging this myself and was about to raise an issue! I'm also on Ubuntu (20.04).

In my case it seems to be an issue with dynamic importing (deno module nessie is causing this for me). I debugged it using the --inspect-brk command and found the source await import("file:///home/.../file.ts").

Once i found that it was a bug's source was a dynamic import i tried a basic dynamic import in my root server.ts in all ways await import("file:///home/..../file.ts") await import("/home/...../file.ts") and even relative await import("./file.ts") all failed.

Give this a shot and see if it's the same problem. If so would love a response from deno.

This problem was a regression in v1.0.3 and was fixed in v1.0.4; can you try upgrading and checking the result?

Still the same issue using Deno 1.0.4
Like hazza203 has pointed out it has to do with a dynamic importing like:
import ListUsers from './ListUsers.jsx';

I upgraded but the issue persisted. I also reloaded the cache after.

However, I've managed to isolate the issue some more. My initial assumption on dynamic import's was a bit off. I've isolated it down to this package Dex.
I've stripped the code completely down to import dex as in the manual:
import Dex from "https://deno.land/x/dex/mod.ts";
Any single reference of Dex after the import causes the error, even just console.log(Dex).

Now could this be an issue with on Dex's end? Seems plausible but at the same time i'm not really executing any of their code.

Like hazza203 has pointed out it has to do with a dynamic importing like:
import ListUsers from './ListUsers.jsx';

Are you sure it's from that and not from import React from 'https://dev.jspm.io/react';? If so our issues may not be linked but it's hard to tell, i've hardly seen this error come up anywhere.

It would be helpful to post a -L debug to help diagnose the problem.

-L debug produces a giant log, I am including the last few rows, please let me know if you need more.

fetch_source_file specifier: https://deno.land/[email protected]/path/_globrex.ts ⚠️️ Granted network access to "https://deno.land/[email protected]/path/_globrex.ts" fetch_source_file specifier: https://deno.land/[email protected]/fmt/colors.ts ⚠️️ Granted network access to "https://deno.land/[email protected]/fmt/colors.ts" fetch_source_file specifier: https://deno.land/[email protected]/testing/diff.ts ⚠️️ Granted network access to "https://deno.land/[email protected]/testing/diff.ts" compiled filename: "/home/ubuntu/.cache/deno/gen/file/mnt/c/Users/ubuntu/Documents/web/deno-react-example/server.tsx.js" register_complete file:///mnt/c/Users/ubuntu/Documents/web/deno-react-example/server.tsx register_complete https://dev.jspm.io/react register_complete https://dev.jspm.io/react-dom/server error: No such file or directory (os error 2)

Apologies, wasn't aware of the command. Dumped it to a txt file.

debug.txt

And also here is the last few lines (the text file is poorly formatted)

⚠️️ Granted network access to "https://dev.jspm.io/npm:@jspm/[email protected]/nodelibs/url.js"
byte pos BytePos(0) is on the line at byte pos BytePos(0)
char pos CharPos(0) is on the line at char pos CharPos(0)
byte is on line: 1
byte pos BytePos(31) is on the line at byte pos BytePos(31)
char pos CharPos(31) is on the line at char pos CharPos(31)
byte is on line: 2
fetch_source_file specifier: https://dev.jspm.io/npm:@jspm/[email protected]/nodelibs/punycode.js
⚠️️ Granted network access to "https://dev.jspm.io/npm:@jspm/[email protected]/nodelibs/punycode.js"
fetch_source_file specifier: https://dev.jspm.io/npm:@jspm/[email protected]/nodelibs/querystring.js
⚠️️ Granted network access to "https://dev.jspm.io/npm:@jspm/[email protected]/nodelibs/querystring.js"
fetch_source_file specifier: https://dev.jspm.io/npm:@jspm/[email protected]/nodelibs/@empty.js
⚠️️ Granted network access to "https://dev.jspm.io/npm:@jspm/[email protected]/nodelibs/@empty.js"
fetch_source_file specifier: https://deno.land/std/node/_util/_util_callbackify.ts
⚠️️ Granted network access to "https://deno.land/std/node/_util/_util_callbackify.ts"
fetch_source_file specifier: https://deno.land/std/node/_util/_util_types.ts
⚠️️ Granted network access to "https://deno.land/std/node/_util/_util_types.ts"
fetch_source_file specifier: https://deno.land/std/node/_utils.ts
⚠️️ Granted network access to "https://deno.land/std/node/_utils.ts"
fetch_source_file specifier: https://deno.land/std/testing/diff.ts
⚠️️ Granted network access to "https://deno.land/std/testing/diff.ts"
compiled filename: "/home/harry/.cache/deno/gen/file/home/harry/Personal/disk-jockey/server.ts.js"
register_complete file:///home/harry/Personal/disk-jockey/server.ts
compiled filename: "/home/harry/.cache/deno/gen/https/deno.land/x/dex/mod-dyn.ts.js"
register_complete https://deno.land/x/dex/mod-dyn.ts
register_complete https://deno.land/x/dex/lib-dyn/index.js
register_complete https://deno.land/x/dex/lib-dyn/knex.js
register_complete https://deno.land/x/dex/lib-dyn/raw.js
register_complete https://deno.land/x/dex/lib-dyn/client.js
register_complete https://deno.land/x/dex/lib-dyn/query/builder.js
register_complete https://deno.land/x/dex/lib-dyn/query/methods.js
register_complete https://deno.land/x/dex/lib-dyn/util/make-knex.js
register_complete https://deno.land/x/dex/lib-dyn/util/parse-connection.js
register_complete https://deno.land/x/dex/lib-dyn/util/timeout.js
register_complete https://deno.land/x/dex/lib-dyn/util/fake-client.js
register_complete https://deno.land/x/dex/lib-dyn/constants.js
register_complete https://deno.land/x/dex/lib-dyn/helpers.js
register_complete https://deno.land/x/dex/lib-dyn/dialects/mssql/index.js
register_complete https://deno.land/x/dex/lib-dyn/dialects/mysql/index.js
register_complete https://deno.land/x/dex/lib-dyn/dialects/mysql2/index.js
register_complete https://deno.land/x/dex/lib-dyn/dialects/oracledb/index.js
register_complete https://deno.land/x/dex/lib-dyn/dialects/postgres/index.js
register_complete https://deno.land/x/dex/lib-dyn/dialects/redshift/index.js
register_complete https://deno.land/x/dex/lib-dyn/dialects/sqlite3/index.js
error: No such file or directory (os error 2)

I second this:

However, I've managed to isolate the issue some more. My initial assumption on dynamic import's was a bit off. I've isolated it down to this package Dex.
I've stripped the code completely down to import dex as in the manual:
import Dex from "https://deno.land/x/dex/mod.ts";
Any single reference of Dex after the import causes the error, even just console.log(Dex).

The same is valid for other sqlite3 handler libs not just dex! (Like cotton, denodb, [..])
And the error didn't start right after using the libaries the first time, i think it started after a while of running denon. At least that's how i remember it.

Log looks a lot like @hazza203 's at least the last lines.

log.txt

Ah guys, at least for cotton it works after clearing the cache;
Do the following:

  1. Execute in Terminal: deno info
  2. let path = Copy the path from "Remote modules cache" from Terminal
  3. rm -rf ${path} or other way of clearing the cache.

This got me running again with 1.0.4 though you should take a look at the Repo of the SQL Lib u are using if it has been updated to SQLite3 2.0.0.

This did not work for me, still the same: error: No such file or directory (os error 2)
I am using deno 1.0.4, thanks

I have the same problem here:

env: Linux x86_64
third_party_modules: oak and view_engine

Case:
How to reproduce:

  1. Using deno 1.0,5
  2. make some code with some 3rd party module with folders (test code: https://github.com/withered-flowers/learn-deno)
  3. run the file deno run --allow-net --allow-read --reload index.ts
  4. error: No such file or directory (os error 2)

Temporary solution:

  1. Downgrade to 1.0.0 (deno upgrade --version 1.0.0)
  2. run the file deno run --allow-net --allow-read --reload index.ts
  3. it works.

Turns out that on the version 1.0.5 running file, not all file compiled, while there's some additional file downloaded.

Maybe that's why the error no such file or directory appeared?

Log of Files downloaded @ v1.0.0 and v1.0.5
log1.0.0-sorted.txt
log1.0.0.txt
log1.0.5-sorted.txt
log1.0.5.txt

debug v1.0.5
debug1.0.5.txt

Edit:
Error starts from v1.0.3, here's the debug:
debug1.0.3.txt

Hi, same issues

os

wsl 2
ubuntu 20.04

deno version

deno 1.0.5
v8 8.4.300
typescript 3.9.2

example

import { assertEquals } from "https://deno.land/std/testing/asserts.ts";

Deno.test("hello world", () => {
    const x = 1 + 2;
    assertEquals(x, 3);
});

run deno test index.js -L debug

Deno isolate init with snapshots.
rust:shared_queue:reset
DEBUG JS - cwd /home/tan/hkm
DEBUG JS - args []
fetch_source_file specifier: file:///home/tan/hkm/.deno.test.ts
byte pos BytePos(0) is on the line at byte pos BytePos(0)
char pos CharPos(0) is on the line at char pos CharPos(0)
byte is on line: 1
fetch_source_file specifier: file:///home/tan/hkm/index.js
⚠️️  Granted read access to "/home/tan/hkm/index.js"
byte pos BytePos(0) is on the line at byte pos BytePos(0)
char pos CharPos(0) is on the line at char pos CharPos(0)
byte is on line: 1
fetch_source_file specifier: https://deno.land/std/testing/asserts.ts
⚠️️  Granted network access to "https://deno.land/std/testing/asserts.ts"
byte pos BytePos(203) is on the line at byte pos BytePos(203)
char pos CharPos(203) is on the line at char pos CharPos(203)
byte is on line: 5
byte pos BytePos(281) is on the line at byte pos BytePos(281)
char pos CharPos(281) is on the line at char pos CharPos(281)
byte is on line: 6
fetch_source_file specifier: https://deno.land/std/fmt/colors.ts
⚠️️  Granted network access to "https://deno.land/std/fmt/colors.ts"
fetch_source_file specifier: https://deno.land/std/testing/diff.ts
⚠️️  Granted network access to "https://deno.land/std/testing/diff.ts"
compiled filename: "/home/tan/.cache/deno/gen/file/home/tan/hkm/.deno.test.ts.js"
register_complete file:///home/tan/hkm/.deno.test.ts
register_complete file:///home/tan/hkm/index.js
error: No such file or directory (os error 2)

update

rename test file index.js to index.ts
There no error occur, and here is debug log

Deno isolate init with snapshots.
rust:shared_queue:reset
DEBUG JS - cwd /home/tan/hkm
DEBUG JS - args []
fetch_source_file specifier: file:///home/tan/hkm/.deno.test.ts
byte pos BytePos(0) is on the line at byte pos BytePos(0)
char pos CharPos(0) is on the line at char pos CharPos(0)
byte is on line: 1
fetch_source_file specifier: file:///home/tan/hkm/index.ts
⚠️️  Granted read access to "/home/tan/hkm/index.ts"
byte pos BytePos(0) is on the line at byte pos BytePos(0)
char pos CharPos(0) is on the line at char pos CharPos(0)
byte is on line: 1
fetch_source_file specifier: https://deno.land/std/testing/asserts.ts
⚠️️  Granted network access to "https://deno.land/std/testing/asserts.ts"
byte pos BytePos(203) is on the line at byte pos BytePos(203)
char pos CharPos(203) is on the line at char pos CharPos(203)
byte is on line: 5
byte pos BytePos(281) is on the line at byte pos BytePos(281)
char pos CharPos(281) is on the line at char pos CharPos(281)
byte is on line: 6
fetch_source_file specifier: https://deno.land/std/fmt/colors.ts
⚠️️  Granted network access to "https://deno.land/std/fmt/colors.ts"
fetch_source_file specifier: https://deno.land/std/testing/diff.ts
⚠️️  Granted network access to "https://deno.land/std/testing/diff.ts"
compiled filename: "/home/tan/.cache/deno/gen/file/home/tan/hkm/.deno.test.ts.js"
register_complete file:///home/tan/hkm/.deno.test.ts
compiled filename: "/home/tan/.cache/deno/gen/file/home/tan/hkm/index.ts.js"
register_complete file:///home/tan/hkm/index.ts
compiled filename: "/home/tan/.cache/deno/gen/https/deno.land/std/testing/asserts.ts.js"
register_complete https://deno.land/std/testing/asserts.ts
compiled filename: "/home/tan/.cache/deno/gen/https/deno.land/std/fmt/colors.ts.js"
register_complete https://deno.land/std/fmt/colors.ts
compiled filename: "/home/tan/.cache/deno/gen/https/deno.land/std/testing/diff.ts.js"
register_complete https://deno.land/std/testing/diff.ts
write rid=1
running 1 tests
write rid=1
test hello world ... DEBUG JS - sendSync op_resources 62
DEBUG JS - sendSync op_metrics 2
DEBUG JS - sendAsync op_global_timer 68
rust:shared_queue:pre-push: op=68, off=812, end=835, len=23, aligned_end=836
rust:shared_queue:push: num_records=1, num_shifted_off=0, head=836
DEBUG JS - sendSync op_global_timer_stop 67
DEBUG JS - sendSync op_metrics 2
DEBUG JS - sendSync op_resources 62
write rid=1
ok (4ms)
write rid=1

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out (5ms)

I have the same problem here:

env: Linux x86_64
third_party_modules: oak and view_engine

Case:
How to reproduce:

  1. Using deno 1.0,5
  2. make some code with some 3rd party module with folders (test code: https://github.com/withered-flowers/learn-deno)
  3. run the file deno run --allow-net --allow-read --reload index.ts
  4. error: No such file or directory (os error 2)

Temporary solution:

  1. Downgrade to 1.0.0 (deno upgrade --version 1.0.0)
  2. run the file deno run --allow-net --allow-read --reload index.ts
  3. it works.

Turns out that on the version 1.0.5 running file, not all file compiled, while there's some additional file downloaded.

Maybe that's why the error no such file or directory appeared?

Log of Files downloaded @ v1.0.0 and v1.0.5
log1.0.0-sorted.txt
log1.0.0.txt
log1.0.5-sorted.txt
log1.0.5.txt

debug v1.0.5
debug1.0.5.txt

Edit:
Error starts from v1.0.3, here's the debug:
debug1.0.3.txt

I have this error with latest version of Deno and it already cost me 2 hours to fix but no luck. Your answer solved my problem :) Its working! Thank you!

I had the same problem, but upgrading Deno to 1.0.5 helped.

Environment
Ubuntu: 18.04
deno 1.0.5
v8 8.4.300
typescript 3.9.2

I had the same problem, but upgrading Deno to 1.0.5 helped.

Environment
Ubuntu: 18.04
deno 1.0.5
v8 8.4.300
typescript 3.9.2

Not for me.
Using Oak and dotenv on Manjaro Linux.

deno 1.0.5
v8 8.4.300
typescript 3.9.2

(System TS is 3.9.5 tho)

I encountered the same issue when attempt to build docker. Docker build was fine until Dex import was added.

Docker using deno version 1.0.5

register_complete https://deno.land/x/dex/lib/util/save-async-stack.js
error: No such file or directory (os error 2)


Interestingly when downgrading to 1.0.0 the error disappeared. Docker image was able to complete its build.

Re-upgade to 1.0.5 and error re-occurs.

edit: further info..

Step 6/10 : RUN deno --version
---> Running in 140613d20077
deno 1.0.5
v8 8.4.300
typescript 3.9.2

Error persists even after using no-cache build of docker

Most likely introduced in #5817, I will look into this issue

I think this only happens on Ubuntu, not on macOS. For example I have this issue importing the brotli module when using Deno 1.03 and above, but no problem on macOS.

@wongjiahau I can not really confirm this claim, i am on MacOS had the same problem. Though i can not reproduce it after a cache clear and an updated libary. (i'm assuming this has something to do with nestet libary errors; kinda sounds like #5817)

Hello!
I have the same problem
OS: macos Mojave
Deno: 1.0.5
Use: https://deno.land/x/oak

Seeing the same issue when trying to run npm install or yarn via Deno.run in a cloned repo.

OS: Win10
Deno: 1.0.0 - 1.0.5
Scenario: https://github.com/Chevron-9/create-nwb-app/blob/master/postclone.ts#L79

Debug log:

  Granted read access to "C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app\next-with-batteries-auth-i18n\.git"
⚠️️  Granted write access to "C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app\next-with-batteries-auth-i18n\.git"
⚠️️  Granted write access to "C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app\next-with-batteries-auth-i18n\__oldGit"
op_rename C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app\next-with-batteries-auth-i18n\.git C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app\next-with-batteries-auth-i18n\__oldGit
Cannot remove .git repository on windows. Please remove the leftover "__oldGit" folder yourself.
DEBUG JS - sendSync op_run 56
⚠️️  Granted access to run a subprocess
DEBUG JS - sendAsync op_run_status 57
⚠️️  Granted access to run a subprocess
rust:shared_queue:pre-push: op=57, off=812, end=881, len=69, aligned_end=884
rust:shared_queue:push: num_records=1, num_shifted_off=0, head=884
read rid=7
rust:shared_queue:pre-push: op=31, off=812, end=824, len=12, aligned_end=824
rust:shared_queue:push: num_records=1, num_shifted_off=0, head=824
read rid=7
rust:shared_queue:pre-push: op=31, off=812, end=824, len=12, aligned_end=824
rust:shared_queue:push: num_records=1, num_shifted_off=0, head=824
DEBUG JS - sendSync op_close 63
DEBUG JS - sendSync op_run 56
⚠️️  Granted access to run a subprocess
DEBUG JS - sendAsync op_run_status 57
⚠️️  Granted access to run a subprocess
rust:shared_queue:pre-push: op=57, off=812, end=881, len=69, aligned_end=884
rust:shared_queue:push: num_records=1, num_shifted_off=0, head=884
read rid=10
rust:shared_queue:pre-push: op=31, off=812, end=824, len=12, aligned_end=824
rust:shared_queue:push: num_records=1, num_shifted_off=0, head=824
DEBUG JS - sendSync op_close 63
DEBUG JS - sendSync op_run 56
⚠️️  Granted access to run a subprocess
DEBUG JS - sendAsync op_run_status 57
⚠️️  Granted access to run a subprocess
rust:shared_queue:pre-push: op=57, off=812, end=881, len=69, aligned_end=884
rust:shared_queue:push: num_records=1, num_shifted_off=0, head=884
read rid=13
rust:shared_queue:pre-push: op=31, off=812, end=824, len=12, aligned_end=824
rust:shared_queue:push: num_records=1, num_shifted_off=0, head=824
read rid=13
rust:shared_queue:pre-push: op=31, off=812, end=824, len=12, aligned_end=824
rust:shared_queue:push: num_records=1, num_shifted_off=0, head=824
read rid=13
rust:shared_queue:pre-push: op=31, off=812, end=824, len=12, aligned_end=824
rust:shared_queue:push: num_records=1, num_shifted_off=0, head=824
DEBUG JS - sendSync op_close 63

Installing dependencies...
DEBUG JS - sendSync op_run 56
⚠️️  Granted access to run a subprocess
An error occured during project initialization.
Please ensure that
  - the template exists: "https://github.com/Chevron-9/nwb-template-auth-i18n.git"
  - you're online

Error: "Das System kann die angegebene Datei nicht finden. (os error 2)"

Done in 2.25s.

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

@bartlomieju in case it helps, this small commit caused it for me in CI, whereas the previous commit passed:
https://github.com/sholladay/pogo/pull/17/commits/baf7734f37a0b64c2362abee68bbdbce60b16f99

So, unless there are mutliple causes, it's got to be a regression on Deno ~1.0.3, 1.0.4, or 1.0.5~ (edit: I tried each version by hand and it breaks on 1.0.3).

The relevant part of the CI log:

Compile file:///home/travis/build/sholladay/pogo/.deno.test.ts
error: No such file or directory (os error 2)

Sadly I'm still seeing this error after upgrading to v1.1.0 when trying to execute yarn | yarn install or npm install through Deno.run. It throws instantly on Deno.run, not through process.stderr.

Setting up new repository...
DEBUG JS - sendSync op_stat 18
⚠️️  Granted read access to "C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.git"
op_stat C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.git false
DEBUG JS - sendSync op_stat 18
⚠️️  Granted read access to "C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\__oldGit"
op_stat C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\__oldGit true
DEBUG JS - sendSync op_rename 21
⚠️️  Granted read access to "C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.git"
⚠️️  Granted write access to "C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.git"
⚠️️  Granted write access to "C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\__oldGit"
op_rename C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.git C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\__oldGit
Cannot remove .git repository on windows. Please remove the leftover "__oldGit" folder yourself.
{
  opts: {
    cmd: [ "git", "init" ],
    cwd: "C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n",
    stdout: "piped",
    stderr: "piped"
  }
}
DEBUG JS - sendSync op_run 58
⚠️️  Granted access to run a subprocess
DEBUG JS - sendAsync op_run_status 59
⚠️️  Granted access to run a subprocess
rust:shared_queue:pre-push: op=59, off=812, end=881, len=69, aligned_end=884
rust:shared_queue:push: num_records=1, num_shifted_off=0, head=884
Process { rid: 8, pid: 8580, stdout: File { rid: 6 }, stderr: File { rid: 7 } }
read rid=6
rust:shared_queue:pre-push: op=32, off=812, end=824, len=12, aligned_end=824
rust:shared_queue:push: num_records=1, num_shifted_off=0, head=824
read rid=6
rust:shared_queue:pre-push: op=32, off=812, end=824, len=12, aligned_end=824
rust:shared_queue:push: num_records=1, num_shifted_off=0, head=824
DEBUG JS - sendSync op_close 65
Moving .env file...
DEBUG JS - sendSync op_stat 18
⚠️️  Granted read access to "C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.env.example"
op_stat C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.env.example true
DEBUG JS - sendSync op_stat 18
⚠️️  Granted read access to "C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.env"
op_stat C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.env true
DEBUG JS - sendSync op_copy_file 17
⚠️️  Granted read access to "C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.env.example"
⚠️️  Granted write access to "C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.env"
op_copy_file C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.env.example C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.env

Installing dependencies...
{
  opts: {
    cmd: [ "yarn" ],
    cwd: "C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n",
    stdout: "piped",
    stderr: "piped"
  }
}
DEBUG JS - sendSync op_run 58
⚠️️  Granted access to run a subprocess
An error occured during project initialization.
Error: "Das System kann die angegebene Datei nicht finden. (os error 2)"

deno-react-example using deno 1.1.0 stll throws: error: No such file or directory (os error 2)

@ljosberinn are you using .jsx in your project?

@Bidek56 thanks for report, I tested again and found problematic bit.

The repo itself has no .jsx.
The _cloned_ repo contains .tsx files, so... yes, I guess?

Upgrading to 1.1.0 fixed the issue

@bartlomieju When do you think this fix will make it into a release?
Is there a nightly build that I can try? Thx

@bartlomieju When do you think this fix will make it into a release?
Is there a nightly build that I can try? Thx

There's currently no nightly build - you'd have to build it yourself. I think 1.1.1 might be released this week.

This problem is happening on Ubuntu even when I'm on Deno 1.1.0, I suspect it's due to importing *.tsx files. Because when I upgrade to Deno 1.1.0 this problem does not occur until I recently added *.tsx files into my project.

Guys, remember to use deno cache --reload <file>!
Fixed it for me after 1.1.0 upgrade.

1.1.1 release fixes the issue. Thanks @bartlomieju !!

@Bidek56 great to hear that, thanks for seeing it through!

Sadly still persisting when trying to execute npm install or yarn install.

Reloaded all caches via deno cache --unstable --reload src/mod.ts.

Code in question:
https://github.com/Chevron-9/create-nwb-app-deno/blob/master/src/mod.ts#L45
-> https://github.com/Chevron-9/create-nwb-app-deno/blob/master/src/utils.ts#L86

λ deno --version
deno 1.1.1
v8 8.5.104
typescript 3.9.2
Setting up new repository...
DEBUG JS - sendSync op_stat 18
⚠️️  Granted read access to "C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.git"
op_stat C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.git false
DEBUG JS - sendSync op_stat 18
⚠️️  Granted read access to "C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\__oldGit"
op_stat C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\__oldGit true
DEBUG JS - sendSync op_rename 21
⚠️️  Granted read access to "C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.git"
⚠️️  Granted write access to "C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.git"
⚠️️  Granted write access to "C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\__oldGit"
op_rename C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.git C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\__oldGit
Cannot remove .git repository on windows. Please remove the leftover "__oldGit" folder yourself.
DEBUG JS - sendSync op_run 58
⚠️️  Granted access to run a subprocess
DEBUG JS - sendAsync op_run_status 59
⚠️️  Granted access to run a subprocess
rust:shared_queue:pre-push: op=59, off=812, end=881, len=69, aligned_end=884
rust:shared_queue:push: num_records=1, num_shifted_off=0, head=884
read rid=6
rust:shared_queue:pre-push: op=32, off=812, end=824, len=12, aligned_end=824
rust:shared_queue:push: num_records=1, num_shifted_off=0, head=824
read rid=6
rust:shared_queue:pre-push: op=32, off=812, end=824, len=12, aligned_end=824
rust:shared_queue:push: num_records=1, num_shifted_off=0, head=824
DEBUG JS - sendSync op_close 65
Moving .env file...
DEBUG JS - sendSync op_stat 18
⚠️️  Granted read access to "C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.env.example"
op_stat C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.env.example true
DEBUG JS - sendSync op_stat 18
⚠️️  Granted read access to "C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.env"
op_stat C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.env true
DEBUG JS - sendSync op_copy_file 17
⚠️️  Granted read access to "C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.env.example"
⚠️️  Granted write access to "C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.env"
op_copy_file C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.env.example C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n\.env

Installing dependencies...
{ cmd: [ "yarn", "install" ] }
DEBUG JS - sendSync op_run 58
⚠️️  Granted access to run a subprocess
An error occured during project initialization.
Please ensure that
  - the template exists: "https://github.com/ljosberinn/personal-react-boilerplate"
  - you're online

Error: "Das System kann die angegebene Datei nicht finden. (os error 2)"

DEBUG JS - sendSync op_remove 16
⚠️️  Granted 
⚠️️  Granted write access to "C:\Users\gerr.it\Desktop\dev\chevron-9\create-nwb-app-deno\next-with-batteries-auth-i18n"
op_remove next-with-batteries-auth-i18n true
Could not rollback entirely due to a lack of permissions.
Done in 4.37s.

Hi @bartlomieju I have found a minimal example to reproduce this issue on [email protected] on Ubuntu 18.

Steps to reproduce

  1. Create a file name main.ts with the following content:
import { compress as brotliCompress } from "https://deno.land/x/[email protected]/mod.ts";

Deno.test('hello', () => {
  brotliCompress(new TextEncoder().encode('his'))
  console.log('helo')
})
  1. Create a file named tsconfig.json with the following content (which is copied from here, except that the "lib": [], line was removed):
{
  "compilerOptions": {
    "allowJs": false,
    "allowUmdGlobalAccess": false,
    "allowUnreachableCode": false,
    "allowUnusedLabels": false,
    "alwaysStrict": true,
    "assumeChangesOnlyAffectDirectDependencies": false,
    "checkJs": false,
    "disableSizeLimit": false,
    "generateCpuProfile": "profile.cpuprofile",
    "jsx": "react",
    "jsxFactory": "React.createElement",
    "noFallthroughCasesInSwitch": false,
    "noImplicitAny": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noImplicitUseStrict": false,
    "noStrictGenericChecks": false,
    "noUnusedLocals": false,
    "noUnusedParameters": false,
    "preserveConstEnums": false,
    "removeComments": false,
    "resolveJsonModule": true,
    "strict": true,
    "strictBindCallApply": true,
    "strictFunctionTypes": true,
    "strictNullChecks": true,
    "strictPropertyInitialization": true,
    "suppressExcessPropertyErrors": false,
    "suppressImplicitAnyIndexErrors": false,
    "useDefineForClassFields": false
  }
}
  1. Run one of following command:
deno test --config tsconfig.json main.ts

OR

deno run --config tsconfig.json main.ts

Expected result

The test finished peacefully.

Actual result

Download https://deno.land/x/[email protected]/mod.ts
Download https://deno.land/x/[email protected]/wasm.js
Download https://deno.land/x/[email protected]/mod.ts
Download https://deno.land/x/[email protected]/wasm.js
Compile file:///home/runner/work/core/core/.deno.test.ts
error: Failed to get compiled source code of https://deno.land/x/[email protected]/mod.ts.
Reason: No such file or directory (os error 2)

Extra notes

This error only happens when the --config flag is specified, otherwise the commands above run without error.

## Reference
https://github.com/levo-framework/core/pull/50/checks?check_run_id=790043755

Interesting when running: deno test --config tsconfig.json main.ts it fails with:

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

Then: deno test main.ts works
Then: deno test --config tsconfig.json main.ts works

false

@wongjiahau I checked example you have provided - it fails because you set checkJs to false. https://deno.land/x/[email protected]/wasm.js imports https://deno.land/x/[email protected]/mod.ts - if checkJs is false then imports from JS won't be emitted. @kitsonk could you take a look and give your opinion if that's proper behavior?

I see, but based on https://deno.land/manual/getting_started/typescript, “checkJs” is false by default, perhaps the tsconfig in the manual is outdated?

I see, but based on https://deno.land/manual/getting_started/typescript, “checkJs” is false by default, perhaps the tsconfig in the manual is outdated?

The default config is the same, however if any of the dependencies is a .js file that imports .ts/.jsx/.tsx then checkJs is set to true - otherwise those imports wouldn't be transpiled.

Hmmm... need to think about it, because it doesn't feel like we should require checkJs to be true to get all the TypeScript a program needs to be compiled, though it gets a bit complicated. The easiest solution is to just invoke the compiler twice in situations like this and don't change implicitly change checkJs. So if .ts loads .js it just stops the dependency analysis, and when we have a cache miss on a .ts module, we spin the compiler up again.

Or we do the full dependency analysis and when we discover a a.ts -> b.js -> c.ts import, we "promote" the c.ts to a root module for the compile so it doesn't get missed. Actually thinking out loud, that seems like a better idea.

When running
deno test -A -c tsconfig.json --unstable .\std\fs\expand_glob_test.ts with missing tsconfig.json file
error: The system cannot find the file specified. (os error 2) appears, it would be nice to know which file is missing.

I was experiencing the same problem i.e error: No such file or directory (os error 2) while using Deno.writeTextFileSync. It turns out that somewhere in my file I failed to escape /. replacing all instances of / solved my problem.

Good morning, I am using Oak with Deno. When trying to run my code snippet and going to localhost:8000/login, I get the mentioned error (NotFoundError: The system cannot find the file specified. (os error 2)).

Code

import { Application, send, Context, RouterContext, Router } from "./deps.ts";
import { staticFileMiddleware, fileExists } from './staticFileMiddleware.ts';

const app = new Application();

const router = new Router();

router
.get('/', async (context: Context) => {
    console.log('Normal')
    await send(context, context.request.url.pathname, {
        root: `${Deno.cwd()}/public`,
        index: "index.html",
    });
})
.get('/login', async (context) => {
    console.log('I am here');
    await send(context, context.request.url.pathname, {
        root: `${Deno.cwd()}/public`,
        index: 'index.html'
    });
});

app.use(router.routes());
app.use(router.allowedMethods());
app.use(staticFileMiddleware);

app.addEventListener('listen', ({hostname, port, secure}) => {
    console.log(`Listening on ${secure ? 'https://' : 'http://'}${hostname || 'localhost'}:${port}`)
});

app.addEventListener('error', e => {
    console.log(e.error);
});

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

Expected result

When I try to go to localhost:8000, it should display the index.html page. Additionally when I access the URL localhost:8000/login, it should also display the contents of index.html. Unfortunately, this isn't what happens!!

Full Error

NotFoundError: The system cannot find the file specified. (os error 2)
at createHttpError (httpError.ts:129:10)
at send (send.ts:147:13)
at async server.ts:39:5
at async dispatch (middleware.ts:39:7)
at async dispatch (middleware.ts:39:7)
at async dispatch (middleware.ts:39:7)
at async Application.#handleRequest (application.ts:250:9)

v1.2.1 has been released with a fix (#6760) for type declarations imports (.d.ts). Please let me know if that fixes your issues.

There were no reports on this issue for the past two releases so I'm going to close this one again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GerbenRampaart picture GerbenRampaart  ·  48Comments

hstarorg picture hstarorg  ·  93Comments

guybedford picture guybedford  ·  34Comments

ry picture ry  ·  48Comments

fujiazhang picture fujiazhang  ·  514Comments