Basic run on arch linux: can not find script/file

Umm … I seem to be difficult! :slight_smile:

attempting a basic/simple execution via terminal in /tmp:

╭─    /tmp                                                                                                                                         ✔  at 15:31:17 
╰─ k6 run ./testk6.js

          /\      |‾‾| /‾‾/   /‾‾/
     /\  /  \     |  |/  /   /  /
    /  \/    \    |     (   /   ‾‾\
   /          \   |  |\  \ |  (‾)  |
  / __________ \  |__| \__\ \_____/ .io

ERRO[0000] The moduleSpecifier "./testk6.js" couldn't be found on local disk. 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://k6.io/docs/using-k6/modules#using-local-modules-with-docker.

works if given on STDIN:

╭─    /tmp                                                                                                                                     INT ✘  at 15:38:26 
╰─ cat /tmp/testk6.js | k6 run -

          /\      |‾‾| /‾‾/   /‾‾/
     /\  /  \     |  |/  /   /  /
    /  \/    \    |     (   /   ‾‾\
   /          \   |  |\  \ |  (‾)  |
  / __________ \  |__| \__\ \_____/ .io

  execution: local
     script: -
     output: -

  scenarios: (100.00%) 1 scenario, 10 max VUs, 50s max duration (incl. graceful stop):
           * default: Up to 10 looping VUs for 20s over 3 stages (gracefulRampDown: 30s, gracefulStop: 30s)


running (20.1s), 00/10 VUs, 552 complete and 0 interrupted iterations
default ✓ [======================================] 00/10 VUs  20s

     data_received..................: 6.6 MB 328 kB/s
     data_sent......................: 115 kB 5.7 kB/s
     http_req_blocked...............: avg=3.7ms    min=1.24µs   med=2.09µs   max=280.89ms p(90)=3.14µs   p(95)=3.78µs
     http_req_connecting............: avg=2.4ms    min=0s       med=0s       max=140.04ms p(90)=0s       p(95)=0s
     http_req_duration..............: avg=135.47ms min=125.49ms med=135.26ms max=153.8ms  p(90)=142.06ms p(95)=143.5ms
       { expected_response:true }...: avg=135.47ms min=125.49ms med=135.26ms max=153.8ms  p(90)=142.06ms p(95)=143.5ms
     http_req_failed................: 0.00%  ✓ 0        ✗ 1104
     http_req_receiving.............: avg=56.38µs  min=20.02µs  med=38.2µs   max=3.6ms    p(90)=68.73µs  p(95)=161.55µs
     http_req_sending...............: avg=10.06µs  min=5.22µs   med=9.02µs   max=67.97µs  p(90)=12.96µs  p(95)=14.47µs
     http_req_tls_handshaking.......: avg=1.24ms   min=0s       med=0s       max=143.93ms p(90)=0s       p(95)=0s
     http_req_waiting...............: avg=135.41ms min=125.35ms med=135.19ms max=153.73ms p(90)=141.93ms p(95)=143.45ms
     http_reqs......................: 1104   54.88128/s
     iteration_duration.............: avg=278.44ms min=258.55ms med=270.98ms max=720.16ms p(90)=277.77ms p(95)=279.7ms
     iterations.....................: 552    27.44064/s
     vus............................: 1      min=1      max=10
     vus_max........................: 10     min=10     max=10

system:

* arch linux / garuda
* k6 installed via snap

╭─    /tmp                                                                                                                            ✔  took 21s   at 15:38:54 
╰─ k6 version
k6 v0.39.0 ((devel), go1.18.3, linux/amd64)

script:

╭─    /tmp                                                                                                                                     255 ✘  at 15:35:27 
╰─ cat testk6.js
import http from 'k6/http';

export const options = {
  stages: [
    { duration: '5s', target: 10 }, // simulate ramp-up of traffic from 1 to 100 users over 5 minutes.
    { duration: '10s', target: 10 }, // stay at 100 users for 10 minutes
    { duration: '5s', target: 0 }, // ramp-down to 0 users
  ]
};

export default () => {
  http.get('http://test.k6.io');
};

was able to run via docker (not what id prefer tho):

docker run -it --rm
  -v /tmp:/scripts -v /tmp:/jsonoutput
  grafana/k6
  run --out json=/jsonoutput/k6out.json /scripts/testk6.js

Hi @czrpb, Welcome to the community forum :tada:

From the looks of it snaps can not access /tmp which is confirmed in this thread.

Given that the snap is also not official way we (the k6 team) are packaging k6 I would recommend … not using it.

Given that k6 is a single binary I would recommend just downloading it and putting it in ~/bin and removing it when you no longer need.

There is also k6 AUR, although again it is not official, so I would also not recommend it.

Hope this helps you

1 Like

hi!

thx! ill give that a shot!