question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running Docker image backstopjs results in Error Error: Cannot find module '/src/backstop.json'

See original GitHub issue

Hi together, first of all thanks for BackstopJS. This really is a time saver.

I’ve some trouble running the backstopjs/backstopjs:v3.1.21 image in a Gitlab CI pipeline. Locally it’s not a problem, only on Gitlab it seems to be a problem. I just want to post this issue here for others and I’ve no solution for now - hoping to get more infos with this issue.

I run the following on a Gitlab runner via .gitlab-ci.yml (this is only the first iteration to see how it could work - I don’t want to setup a full-fledged infrastructure for the webserver):

This only for verbose output to see if the volumes are mounted:

docker run --rm --entrypoint "/bin/ls" -v ${PWD}/backstop.json:/src/backstop.json -v ${PWD}/backstop_data/:/src/backstop_data/ backstopjs/backstopjs:v3.1.21 -l
total 8
drwxr-xr-x 2 root root 4096 Apr 13 11:30 backstop.json
drwxr-xr-x 2 root root 4096 Apr 13 11:30 backstop_data

And this to run the official backstopjs/backstopjs image:

$ docker run --rm -v ${PWD}/backstop.json:/src/backstop.json -v ${PWD}/backstop_data/:/src/backstop_data/ backstopjs/backstopjs:v3.1.21 test
BackstopJS v3.1.21
Error Error: Cannot find module '/src/backstop.json'

Does anyone had a similar issue? Thank you in advance.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
silentHoocommented, Apr 19, 2018

The problem was, that I ran the command

docker run --rm -v ${PWD}/backstop.json:/src/backstop.json -v ${PWD}/backstop_data/:/src/backstop_data/ backstopjs/backstopjs:v3.1.21 test

within the script: section of the .gitlab-ci.yml.

This doesn’t work in Gitlab CI. Instead I switched to use backstopjs/backstopjs as the base image for my stage and overwrite the entrypoint to start backstop in script::

test-visual:
  stage: test
  image:
    name: backstopjs/backstopjs:v3.1.21
    entrypoint: [""]
  script:
    - backstop test

So this was not an issue with your docker image, rather than how I configured my .gitlab-ci.yml.

0reactions
tabrez96commented, Feb 19, 2020

Having the same issue in circle ci config. Any idea on how to fix it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix docker container running 'cannot find module' error?
Your Dockerfile seems ok and your project structure, too. I assume that the docker image is faulty for some reason and missing the...
Read more >
backstopjs - npm
Start using backstopjs in your project by running `npm i backstopjs`. ... Pass a --docker flag to render your test in a Docker...
Read more >
BackstopJS Docker Image
A self-contained Docker image to run BackstopJS with no external dependencies. Visual Regression Testing with BackstopJS in a Docker container. Features:.
Read more >
Thanks for this.. I'm having a bit of trouble testing my… |
Visual Regression Testing with BackstopJS in a Docker container ... backstop_1 | Loading config: /src/backstop.json backstop_1 |
Read more >
Visual Regression Testing with BackstopJS in a Docker ...
In case you did not hear about BackstopJs — it is a visual regression testing (VRT) tool for web applications. It supports screen...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found