Importing node modules


I am trying to import winston logger for customizing logging into the file but getting the following error

The moduleSpecifier "winston" has no scheme but we will try to resolve it as remote module. This will be deprecated in the future and all remote modules will need to explicitly use "https" as scheme.
GoError: Module specifier "winston" was tried to be loaded as remote module by prepending "https://" to it, which didn't work. If you are trying to import a nodejs module, this is not supported as k6 is _not_ nodejs based. Please read for more information. Remote resolution error: "Get "https://winston": dial tcp: lookup winston on server misbehaving" at reflect.methodValueCall (native)

How do we import node modules?

k6 is not running on node.js, so a lot of node modules won’t work, especially ones that depend on the networking/fs/system parts of the node standard library. That said, you can bundle and use some node modules in k6, as explained here: Modules