TypeError: core.initializeAsyncOps is not a function
Wyatex opened this issue · 1 comments
Wyatex commented
When I follow the tutorial, this error occurs during runtime:
$ cargo run
Compiling runjs v0.1.0 (D:\projects\rust\runjs)
Finished dev [unoptimized + debuginfo] target(s) in 3.12s
Running `target\debug\runjs.exe`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: TypeError: core.initializeAsyncOps is not a function
at [runjs:runtime.js]:7:10
at [runjs:runtime.js]:28:3', src\main.rs:38:92
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\runjs.exe` (exit code: 101)
When I remove initializeAsyncOps, calling op_write_file will report this error:
cargo run
Compiling runjs v0.1.0 (D:\projects\rust\runjs)
Finished dev [unoptimized + debuginfo] target(s) in 4.70s
Running `target\debug\runjs.exe`
[out]: "Hello" "runjs!"
[err]: "Boom!"
[err]: "Unable to read file" "./log.txt" {}
error: TypeError: invalid promise id: expected type `v8::data::Integer`, got `v8::data::Value`
at Object.writeFile ([runjs:runtime.js]:22:29)
at file:///D:/projects/rust/runjs/example.js:11:13
How should I solve this problem? This is my code.
Wyatex commented
Just update deno_core
to the latest version, no need to call initializeAsyncOps
.