How to fix the Property 'utime' does not exist on type 'typeof Deno' Error
Learn, how to solve the Deno Property ‘utime’ does not exist on type ‘typeof Deno’ error.
When we use a deno standard modules that are not stable yet, we will get the following errors in our terminal.
Example program:
app.js
import { writeJsonSync } from "https://deno.land/std/fs/mod.ts";
writeJsonSync(
"./users.json",
{ name: "john", age: "22" },
);
Error:
➜ deno run --allow-write=./users.json app.js
error: TS2339 [ERROR]: Property 'utime' does not exist on type 'typeof Deno'. 'Deno.utime' is an unstable API. Did you forget to run with the '--unstable' flag?
await Deno.utime(dest, statInfo.atime, statInfo.mtime);
~~~~~
at https://deno.land/std/fs/copy.ts:92:16
TS2339 [ERROR]: Property 'utimeSync' does not exist on type 'typeof Deno'. 'Deno.utimeSync' is an unstable API. Did you forget to run with the '--unstable' flag?
Deno.utimeSync(dest, statInfo.atime, statInfo.mtime);
~~~~~~~~~
at https://deno.land/std/fs/copy.ts:103:10
TS2339 [ERROR]: Property 'symlink' does not exist on type 'typeof Deno'. 'Deno.symlink' is an unstable API. Did you forget to run with the '--unstable' flag?
await Deno.symlink(originSrcFilePath, dest, {
~~~~~~~
at https://deno.land/std/fs/copy.ts:117:16
TS2339 [ERROR]: Property 'symlink' does not exist on type 'typeof Deno'. 'Deno.symlink' is an unstable API. Did you forget to run with the '--unstable' flag?
await Deno.symlink(originSrcFilePath, dest);
~~~~~~~
at https://deno.land/std/fs/copy.ts:121:16
TS2339 [ERROR]: Property 'utime' does not exist on type 'typeof Deno'. 'Deno.utime' is an unstable API. Did you forget to run with the '--unstable' flag?
await Deno.utime(dest, statInfo.atime, statInfo.mtime);
~~~~~
at https://deno.land/std/fs/copy.ts:127:16
TS2339 [ERROR]: Property 'symlinkSync' does not exist on type 'typeof Deno'. 'Deno.symlinkSync' is an unstable API. Did you forget to run with the '--unstable' flag?
Deno.symlinkSync(originSrcFilePath, dest, {
~~~~~~~~~~~
at https://deno.land/std/fs/copy.ts:141:10
TS2339 [ERROR]: Property 'symlinkSync' does not exist on type 'typeof Deno'. 'Deno.symlinkSync' is an unstable API. Did you forget to run with the '--unstable' flag?
Deno.symlinkSync(originSrcFilePath, dest);
~~~~~~~~~~~
at https://deno.land/std/fs/copy.ts:145:10
TS2339 [ERROR]: Property 'utimeSync' does not exist on type 'typeof Deno'. 'Deno.utimeSync' is an unstable API. Did you forget to run with the '--unstable' flag?
Deno.utimeSync(dest, statInfo.atime, statInfo.mtime);
~~~~~~~~~
at https://deno.land/std/fs/copy.ts:152:10
TS2339 [ERROR]: Property 'utime' does not exist on type 'typeof Deno'. 'Deno.utime' is an unstable API. Did you forget to run with the '--unstable' flag?
await Deno.utime(dest, srcStatInfo.atime, srcStatInfo.mtime);
~~~~~
at https://deno.land/std/fs/copy.ts:172:16
TS2339 [ERROR]: Property 'utimeSync' does not exist on type 'typeof Deno'. 'Deno.utimeSync' is an unstable API. Did you forget to run with the '--unstable' flag?
Deno.utimeSync(dest, srcStatInfo.atime, srcStatInfo.mtime);
~~~~~~~~~
at https://deno.land/std/fs/copy.ts:200:10
TS2339 [ERROR]: Property 'link' does not exist on type 'typeof Deno'. 'Deno.link' is an unstable API. Did you forget to run with the '--unstable' flag?
await Deno.link(src, dest);
~~~~
at https://deno.land/std/fs/ensure_link.ts:28:14
TS2339 [ERROR]: Property 'linkSync' does not exist on type 'typeof Deno'. 'Deno.linkSync' is an unstable API. Did you forget to run with the '--unstable' flag?
Deno.linkSync(src, dest);
~~~~~~~~
at https://deno.land/std/fs/ensure_link.ts:52:8
TS2339 [ERROR]: Property 'symlink' does not exist on type 'typeof Deno'. 'Deno.symlink' is an unstable API. Did you forget to run with the '--unstable' flag?
await Deno.symlink(src, dest, {
~~~~~~~
at https://deno.land/std/fs/ensure_symlink.ts:32:16
TS2339 [ERROR]: Property 'symlink' does not exist on type 'typeof Deno'. 'Deno.symlink' is an unstable API. Did you forget to run with the '--unstable' flag?
await Deno.symlink(src, dest);
~~~~~~~
at https://deno.land/std/fs/ensure_symlink.ts:36:16
TS2339 [ERROR]: Property 'symlinkSync' does not exist on type 'typeof Deno'. 'Deno.symlinkSync' is an unstable API. Did you forget to run with the '--unstable' flag?
Deno.symlinkSync(src, dest, {
~~~~~~~~~~~
at https://deno.land/std/fs/ensure_symlink.ts:64:10
TS2339 [ERROR]: Property 'symlinkSync' does not exist on type 'typeof Deno'. 'Deno.symlinkSync' is an unstable API. Did you forget to run with the '--unstable' flag?
Deno.symlinkSync(src, dest);
~~~~~~~~~~~
at https://deno.land/std/fs/ensure_symlink.ts:68:10
Found 16 errors.
To fix this error, we need to enable unstable modules during the runtime by using the --unstable
flag.
deno run --unstable --allow-write=./users.json app.js