My script uses a locally installed module of the name @acceleratxr/utilities as is imported like so
import utils from "@acceleratxr/utilities";
When running my test I get the following warning and error.
WARN[0000] A url was resolved but it didn't have scheme. This will be deprecated in the future and all remote modules will need to explicitly use `https` as scheme url=//@acceleratxr/utilities
ERRO[0005] GoError: The moduleSpecifier "@acceleratxr/utilities" couldn't be retrieved from the resolved url "https://@acceleratxr/utilities". Error : "Get https://@acceleratxr/utilities: dial tcp: lookup acceleratxr: no such host"
It appears that k6 is incorrectly identifying this module as a remote URL when in fact it is a locally installed module. This shouldn't happen.
OK so I found the documentation that says you can't use Node.js modules directly. This is very poorly documented in the initial guides and tutorials. I would suggest putting a big warning in the Getting Started page to avoid confusion as there is currently no mention of this anywhere until much later in the docs.
We need to actually improve the UX of the error messages we display to users when they import or try to run a non-existent file. Right now, running k6 run nonexistent-file.js would result in the following confusing warning+error combo:
WARN[0000] A url was resolved but it didn't have scheme. This will be deprecated in the future and all remote modules will need to explicitly use `https` as scheme url=//nonexistent-file.js
ERRO[0000] The moduleSpecifier "nonexistent-file.js" couldn't be retrieved from the resolved url "https://nonexistent-file.js". Error : "Get https://nonexistent-file.js: dial tcp: lookup nonexistent-file.js: no such host"
The user doesn't know that k6 first tried to load the file locally, and because it didn't find it, tried to treat it as an URL. We do that to be backwards compatible with the functionality of being able to execute k6 run mysite.com/some.js... We're slowly trying to deprecate this by always requiring schemas in URLs (i.e. k6 run https://mysite.com/some.js), but we haven't fully deprecated it yet, thus the first warning. Anyway, the k6 error from v0.24.0 was more informative, so we should go back to something like it:
ERRO[0000] The file "nonexistent-file.js" couldn't be found on local disk, and trying to retrieve it from https://nonexistent-file.js failed as well. Make sure that you've specified the right path to the file. If you're running k6 using the Docker image make sure you have mounted the local directory (-v /local/path/:/inside/docker/path) containing your script and modules so that they're accessible by k6 from inside of the container, see https://docs.k6.io/v1.0/docs/modules#section-using-local-modules-with-docker.
after 0.27.0 the message will be

which I think is sufficient to close this?
Closing this, since the just-merged #1007 added the improved message in the screenshot above
Most helpful comment
We need to actually improve the UX of the error messages we display to users when they
importor try toruna non-existent file. Right now, runningk6 run nonexistent-file.jswould result in the following confusing warning+error combo:The user doesn't know that k6 first tried to load the file locally, and because it didn't find it, tried to treat it as an URL. We do that to be backwards compatible with the functionality of being able to execute
k6 run mysite.com/some.js... We're slowly trying to deprecate this by always requiring schemas in URLs (i.e.k6 run https://mysite.com/some.js), but we haven't fully deprecated it yet, thus the first warning. Anyway, the k6 error from v0.24.0 was more informative, so we should go back to something like it: