denoland/roll-your-own-javascript-runtime

missing the argument for `deno_core::resolve_path`

chengr4 opened this issue ยท 4 comments

with deno_core = "0.181.0"

the method deno_core::resolve_path need to pass a argument for current_dir

Does anyone have an idea to solve this?

Thanks in advance ๐Ÿ™

Hi chengr4,

I did have this problem yesterday, but I have resolved it by using

use std::path::Path;

and place where you are using resolve_path function, parse file_path to Path. like below

let main_module = deno_core::resolve_path(file_path, Path::new(file_path))?;

It has solved the problem to me.

I have attached my main.rs as main.txt.

I hope this will help you.

Thanks.
Saurabh
main.txt

Just ran into this issue as well, I have zero knowledge of Rust, but the second param of resolve_path is for specifying the directory the file should be read from.

To specify that the example.js file is in the current working directory, you could change the code to:

let cwd = std::env::current_dir()?;
let main_module = deno_core::resolve_path(file_path, &cwd)?;

EDIT: If you run into this, you might want to consider lowering the deno_core version in Cargo.toml because there will be more bears on the road once you pass this problem ๐Ÿ˜‰

@bdevos it works to me. thank you very much ๐Ÿ™

Just ran into this issue as well, I have zero knowledge of Rust, but the second param of resolve_path is for specifying the directory the file should be read from.

To specify that the example.js file is in the current working directory, you could change the code to:

let cwd = std::env::current_dir()?;
let main_module = deno_core::resolve_path(file_path, &cwd)?;

EDIT: If you run into this, you might want to consider lowering the deno_core version in Cargo.toml because there will be more bears on the road once you pass this problem ๐Ÿ˜‰

Thanks for the nice suggestion.