Visual Studio Code doesnt find extensions modules

I’m having some problems to run tests through VS Code in Windows.
It cant find the extension modules. For example, i receive that message error:

unknown module: k6/x/sql

Another problem is that VS Code can’t find xk6 executable.

To run my tests without those problems i have to execute through Windows command prompt

Hi @lommez

Thanks for reaching out.

Regarding your issue related to the unknown module k6/x/sql: I would need more context to be able to help you with this issue. How did you install xk6? Which extensions have you compiled it with (were you able to, or do you run into the problem you mention at that point)? If you’re running into an issue when running a script directly, could hint at what the code looks like?
Also, while looking into it, we realized that the xk6 repository README page’s examples are somewhat outdated, and might be misleading. While we work to fix it, I’d like to point out our official listing of extensions, in case you haven’t found it yet: k6 Extensions.

Regarding your issue related to VSCode not finding the xk6 executable: I’m by no mean an expert, but here are some things to look into and verify that might help you:

  • VSCode should inherit your system’s environment, and therefore already have $PATH and $GOPATH set. If the xk6 command works in CMD, but not in VSCode, you could verify that you’re overriding neither your $PATH, nor $GOPATH in your VSCode config?
  • If you’ve installed xk6 using the go install command, the binary will be located in your $GOPATH/bin. Is $GOPATH/bin on your $PATH, and if so, have you tried setting the GOPATH manually in VSCode (if that’s possible)?
  • More general idea: the VSCode Go extension tends to set up good defaults; do you have the extension installed?

Cheers