- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用标准的 deno fs 模块,但编译器提示没有 --unstable
标志。
import { writeJson, readJson } from "https://deno.land/std/fs/mod.ts";
const json = await readJson("input.txt");
console.log(`JSON: ${JSON.stringify(json)}`);
await writeJson("input.txt", json);
我的 deno 版本:
deno 1.0.0-rc2
v8 8.4.300
typescript 3.8.3
我总是得到同样的错误。它们似乎与缺少的模块有关,但我不确定可能缺少什么。
➜ deno-api denoa filetest.ts
Compile file:///home/astone/source/deno-api/filetest.ts
error: TS2339 [ERROR]: Property 'utime' does not exist on type 'typeof Deno'.
await Deno.utime(dest, statInfo.atime, statInfo.mtime);
~~~~~
at https://deno.land/std/fs/copy.ts:90:16
TS2339 [ERROR]: Property 'utimeSync' does not exist on type 'typeof Deno'.
Deno.utimeSync(dest, statInfo.atime, statInfo.mtime);
~~~~~~~~~
at https://deno.land/std/fs/copy.ts:101:10
TS2339 [ERROR]: Property 'symlink' does not exist on type 'typeof Deno'.
await Deno.symlink(originSrcFilePath, dest, type);
~~~~~~~
at https://deno.land/std/fs/copy.ts:114:14
TS2339 [ERROR]: Property 'utime' does not exist on type 'typeof Deno'.
await Deno.utime(dest, statInfo.atime, statInfo.mtime);
~~~~~
at https://deno.land/std/fs/copy.ts:119:16
TS2339 [ERROR]: Property 'symlinkSync' does not exist on type 'typeof Deno'.
Deno.symlinkSync(originSrcFilePath, dest, type);
~~~~~~~~~~~
at https://deno.land/std/fs/copy.ts:132:8
TS2339 [ERROR]: Property 'utimeSync' does not exist on type 'typeof Deno'.
Deno.utimeSync(dest, statInfo.atime, statInfo.mtime);
~~~~~~~~~
at https://deno.land/std/fs/copy.ts:137:10
TS2339 [ERROR]: Property 'utime' does not exist on type 'typeof Deno'.
await Deno.utime(dest, srcStatInfo.atime, srcStatInfo.mtime);
~~~~~
at https://deno.land/std/fs/copy.ts:157:16
TS2339 [ERROR]: Property 'utimeSync' does not exist on type 'typeof Deno'.
Deno.utimeSync(dest, srcStatInfo.atime, srcStatInfo.mtime);
~~~~~~~~~
at https://deno.land/std/fs/copy.ts:185:10
TS2339 [ERROR]: Property 'link' does not exist on type 'typeof Deno'.
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(src, dest);
~~~~~~~~
at https://deno.land/std/fs/ensure_link.ts:52:8
TS2339 [ERROR]: Property 'symlink' does not exist on type 'typeof Deno'.
await Deno.symlink(src, dest, srcFilePathType);
~~~~~~~
at https://deno.land/std/fs/ensure_symlink.ts:31:14
TS2339 [ERROR]: Property 'symlinkSync' does not exist on type 'typeof Deno'.
Deno.symlinkSync(src, dest, srcFilePathType);
~~~~~~~~~~~
at https://deno.land/std/fs/ensure_symlink.ts:58:8
Found 12 errors.
如果我只导入 readJson 模块,那么我不会收到错误。
import { readJson } from "https://deno.land/std/fs/read_json.ts";
我尝试使用标签构建,但我似乎无法弄清楚 1.0.0-rc2
的标签。我尝试了 https://deno.land/std@0.50.0/fs/mod.ts
。
最佳答案
Deno.utime
有 been marked unstable ,这就是为什么你应该使用 --unstable
标志
还有一个 Unresolved 问题:Property 'utime' does not exist on type 'typeof Deno'对于这个错误。
目前有多个APIs which are behind the unstable flag .
As of Deno 1.0.0, the Deno namespace APIs are stable. That means that we will strive to make code working under 1.0.0 continue to work in future versions.
However, not all of Deno's features are ready for production yet. Features which are not ready because they are still in draft phase are locked behind the --unstable command line flag.
使用 Deno.utime
的文件是 copy.ts
和 ensure_symlink.ts
这就是为什么如果你只加载 read_json.ts
你不会得到那个错误,也不需要不稳定的标志。
std/
的最新标签是 std/0.50.0
但您始终可以将 github 存储库直接引用到您想要的任何提交或发布标签。
https://raw.githubusercontent.com/denoland/deno/{tag}/std/fs/read_json.ts
因此您可以将以下内容用于您的代码段:
import { readJson } from 'https://raw.githubusercontent.com/denoland/deno/v1.0.0-rc2/std/fs/read_json.ts'
import { writeJson } from 'https://raw.githubusercontent.com/denoland/deno/v1.0.0-rc2/std/fs/write_json.ts'
关于Deno 属性 'utime' 在类型 'typeof Deno' 上不存在。 await Deno.utime(dest, statInfo.atime, statInfo.mtime);,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61719244/
Deno 声称与浏览器兼容。这是否意味着它有一个窗口/导航器对象,这对于设置 window.location 之类的东西意味着什么? 最佳答案 Deno 中的全局对象目前仅称为 window (和 g
如果我这样做 deno --help表明: compile = 将脚本编译成一个独立的可执行文件 install = 将脚本安装为可执行文件 这两个命令有什么区别? 最佳答案 命令 输出 自包含 1
假设我有 2 个脚本,father.ts 和 child.ts,我如何从father.ts 生成child.ts 并定期从father.ts 向child.ts 发送消息? 最佳答案 您必须使用 Wo
我想卸载 Deno 及其所有缓存包。它在哪里缓存它的包?以及如何确保在安装新版本的 Deno 之前卸载所有缓存包。 最佳答案 如果您使用默认安装位置,那么这里是您系统上的 deno 缓存位置: By
Deno 不使用任何像 npm 这样的包管理器,它只使用 URL 导入第三方依赖项。让我们看下面的例子: 从“https://deno.land/x/abc@v1.0.0-rc8/mod.ts”导入{
我在我的电脑上安装了 1.10.2 版本,我想使用 deno 的最后版本所以如何更新 deno 的版本? 我应该使用安装命令并重新安装吗或者有类似的东西 npm install -g npm@late
来自 this answer ,我知道父进程可以与童工对话,但反过来呢? 最佳答案 从你必须使用的 worker Worker.postMessage self.postMessage('hi') 在
我有一个生成 javascript 的可执行文件,我想将其通过管道传输到 deno run 中,但是 run 子命令似乎只将脚本路径作为参数,并且不支持 - 从 stdin 读取的通常约定。 我知道但
有一个 Deno.watch api 可以监视文件系统事件: const watcher = Deno.watchFs("/"); for await (const event of watcher)
我有一个向外部支持服务发出网络请求的服务。请求使用 TLS,所以我不能使用任何类型的主机名别名,并且开发和生产环境有不同的主机名。 我知道我可以使用 deno package将我的应用程序捆绑成一个单
我从 Drash ( https://github.com/drashland/deno-drash ) 下载了示例应用程序$ deno run --allow-run --allow-read --
我使用 NodeJS,但我知道 Deno 是一个 future 。我真的很想学习 Deno 并为之做出贡献,但我不知道我该如何开始或真正正确的路线图我可以构建以遵循正确的道路。 我真的很想学习和控制它
在 Deno 中,可以对 import 语句中的依赖项进行版本控制,并且没有 package.json喜欢 npm . 但是如何在一个地方管理它的 URL 和版本? 我将在我的系统中声明多个文件和依赖
我之前在 deno 中安装了一些脚本。 如何在 deno 中列出所有已安装的脚本? 是否有任何 deno 子命令可以执行此操作? 最佳答案 所有下载的脚本都存储在 $DENO_DIR/deps $DE
例如,假设我有以下代码: Deno.run({cmd: ['echo', 'hello']}) 我如何收集该命令的输出 hello ? 最佳答案 Deno.run返回 Deno.Process 的实例
我已经安装了 deno通过运行脚本: deno install https://deno.land/std/examples/welcome.ts 我现在如何卸载这个脚本? deno 中是否有可以卸载
我正在尝试使用标准的 deno fs 模块,但编译器提示没有 --unstable 标志。 import { writeJson, readJson } from "https://deno.land
如何解析 deno 中的 URL像 node.js url.parse()? 最佳答案 在 Deno 中解析 URL 不需要外部模块。 URL类作为全局可用,就像在您的浏览器中一样: const ur
我正在使用橡木/deno。我有一个从提供的 ejs 文件提交的表单。如何访问表单正文?当我将它记录到控制台时,它会打印: {type: "form", value: URLSearchParamsIm
尝试在 Deno REPL 中导入模块会导致以下错误: Uncaught SyntaxError: Cannot use import statement outside a module a
我是一名优秀的程序员,十分优秀!