Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module not found: Error: Can't resolve 'env' #1907

Closed
wangyiran125 opened this issue Dec 10, 2019 · 7 comments
Closed

Module not found: Error: Can't resolve 'env' #1907

wangyiran125 opened this issue Dec 10, 2019 · 7 comments
Labels

Comments

@wangyiran125
Copy link

Summary

A clear and concise summary of your question.

Module not found: Error: Can't resolve 'env' in 'D:\project\rust\wasm-pack-template\pkg'

Additional Details

Provide any additional details here.
when i add it to lib.rs

#[wasm_bindgen]
pub fn parseTest() -> String{
    let resp = ureq::get("www.google.com")
         .call();
    let text = resp.into_string().unwrap();
    text
}

cargo.toml add
ureq = { version = "0.11.2", features = ["json"] }

@alexcrichton
Copy link
Contributor

Thanks for the report! This typically means that there's an unresolved import, for example something like:

extern {
    fn foo();
}

where the default import module is env. The ureq crate likely doesn't target WebAssembly yet and would need to be updated to support it!

@ivnsch
Copy link
Contributor

ivnsch commented Jul 8, 2021

Ran across this today and it was indeed because I was using a dependency that doesn't support WASM. Is it easy to improve this error message?

@sf-cg
Copy link

sf-cg commented Feb 28, 2022

I too am using ureq and got this error, I couldn't understand it at all - is there anything that can be done for future people beyond hopefully googling the right thing to spot this issue thread?

@ShayRubach
Copy link

Joining @sf-cg. I have this issue as well, but I have no clue from which crate. I have a working Rust lib that I compiled into wasm and I want to call its API from some JS code. Without a more informative error, I have no idea which one of the dozen crates I have there causes the issue..

@5learn5
Copy link

5learn5 commented Feb 14, 2023

facing same issue. Any suggestions how I can come over it ?

@kalzoo
Copy link

kalzoo commented Jun 27, 2023

Started a discussion on this issue here

@kalzoo
Copy link

kalzoo commented Jul 3, 2023

Solved, thanks to @Liamolucko ! See discussion linked above ☝️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants