Jenkins error Install Xvfb and run Cypress again - docker

Create a pipeline to do the jenkins cypress test, but I always run it, make a mistake, and try various solutions, including Jenkins Xvfb, but I still didn't succeed.
Error
+ npm run exec:e2e
> projectname#0.1.0 exec:e2e /var/lib/jenkins/workspace/project/myproject
> npx cypress run
It looks like this is your first time using Cypress: 3.4.0
[?25l[01:56:21] Verifying Cypress can run /var/lib/jenkins/.cache/Cypress/3.4.0/Cypress [started]
[01:56:21] Verifying Cypress can run /var/lib/jenkins/.cache/Cypress/3.4.0/Cypress [failed]
[?25hYour system is missing the dependency: Xvfb
Install Xvfb and run Cypress again.
Read our documentation on dependencies for more information:
https://on.cypress.io/required-dependencies
If you are using Docker, we provide containers with all required dependencies installed.
----------
Error: spawn Xvfb ENOENT
----------
Platform: linux (Ubuntu Linux - 19.04)
Cypress Version: 3.4.0
[?25hnpm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! projectname#0.1.0 exec:e2e: `npx cypress run`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the projectname#0.1.0 exec:e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /var/lib/jenkins/.npm/_logs/2019-07-24T01_56_21_795Z-debug.log

I get resolved this question with other solution.
First, i created a pipeline
stage('E2E Tests') {
sh 'docker run -v $PWD:/e2e -w /e2e cypress/included:3.4.0'
}

What you can do is having a lock on your stage
stage('Run E2E tests') {
dir("cypress-e2e-tests") {
lock("cypress-e2e-tests-${env.NODE_NAME}") {
sh 'docker run -v $PWD:/e2e -w /e2e cypress/included:3.4.0'
}
}
}

Related

How to resolve npm ERR! Missing script: "sonar" while executing npm run sonar

I got error npm ERR! Missing script: "sonar" while executing jenkins pipeline job with sonarqube and jenkins integration. Below is the error details.Please anyone got how to solve this error.
thanks in advance.
C:\ProgramData\Jenkins\.jenkins\workspace\sonarqube-pipeline>npm run sonar
npm ERR! Missing script: "sonar"
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR! npm run
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Windows\system32\config\systemprofile\AppData\Local\npm-cache\_logs\2022-11-25T12_42_55_010Z-debug-0.log
Thanks joe clay,
Now it is working fine.After adding below code in sonar-project.js
"sonar": "node sonar-project.js"
"test": "echo "Error: no test specified" && exit 1"
Thanks for your response it was so much helpful.

Error on Running selenium test on alpine docker container

Dockerfile:
FROM node:8.14.1-alpine
RUN apk update && apk add --no-cache openjdk8-jre
RUN apk update && apk add python py-pip curl unzip libexif udev nano
ENV CHROME_BIN=/usr/bin/chromium-browser
RUN echo #v3.8 http://nl.alpinelinux.org/alpine/v3.8/community >> /etc/apk/repositories && \
echo #v3.8 http://nl.alpinelinux.org/alpine/v3.8/main >> /etc/apk/repositories && \
apk add --no-cache \
chromium#v3.8 \
nss#v3.8
# Tell Puppeteer to skip installing Chrome. We'll be using the installed package.
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
WORKDIR /project_compile/vue_app
COPY vue_app /project_compile/vue_app
RUN rm -rf node_modules
RUN npm config set registry http://registry.npmjs.org/ && npm install
CMD npm run test:e2e:headless
When it is run, this error happens:
Error retrieving a new session from the selenium server
Connection refused! Is selenium server started?
{ value:
{ message: 'Timed out waiting for driver server to start.\nBuild info: version: \'3.141.59\', revision: \'e82be7d358\', time: \'2018-11-14T08:25:53\'\nSystem info: host: \'a3f993cb3a2b\', ip: \'172.22.0.2\', os.name: \'Linux\', os.arch: \'amd64\', os.version: \'4.15.0-33-generic\', java.version: \'1.8.0_191\'\nDriver info: driver.version: unknown',
error: 'unknown error' },
status: 13 }
ERROR Error: Command failed: /project_compile/vue_app/node_modules/nightwatch/bin/nightwatch --config nightwatch.conf.js --env chrome
Error: Command failed: /project_compile/vue_app/node_modules/nightwatch/bin/nightwatch --config nightwatch.conf.js --env chrome
at makeError (/project_compile/vue_app/node_modules/execa/index.js:174:9)
at Promise.all.then.arr (/project_compile/vue_app/node_modules/execa/index.js:278:16)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue_app#0.1.0 test:e2e:headless: `vue-cli-service test:e2e --config nightwatch.conf.js --env chrome`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue_app#0.1.0 test:e2e:headless script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-01-14T12_14_57_744Z-debug.log
Seems that chrome works correctly (testable running something like chromium-browser --headless --no-sandbox --dump-dom https://www.chromestatus.com/) and also selenium seems to be working fine.
Why does the test not run? The error is not explainable.
All code is contained in this repo https://github.com/nicolalandro/vue-selenium-docker. So reproducing it is easy - clone the repo and run two commands:
docker-compose -f docker/test/js/docker-compose-js-e2e.yml build
docker-compose -f docker/test/js/docker-compose-js-e2e.yml up --exit-code-from e2e
Maybe you have to wait for selenium container to be up?
check out this guide:
https://github.com/SeleniumHQ/docker-selenium#waiting-for-the-grid-to-be-ready
Write down a script to check for "ready": true,
The problem was that the selenium version was not aligned to chrome version.

Apollo iOS: Run script, Build fail Error

I installed the pod apollo according to this manual, then at the stage where you have to create a run-time, the build does not work, it returns this error I do not understand why ..
Can't find Apollo CLI. Installing...
npm ERR! Error while executing:
npm ERR! /Applications/Xcode.app/Contents/Developer/usr/bin/git ls-remote -h -t ssh://git#github.com/Project/fitto-ios.git
npm ERR!
npm ERR! git#github.com: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mickaelbelhassen/.npm/_logs/2018-08-21T13_43_18_743Z-debug.log
Command /bin/sh failed with exit code 1
And I do not understand why he talks about git ..
Also, the repository ssh://git#github.com/Project/fitto-ios.git is my remote repository, it has nothing to do with Apollo.
Here is my run script is the same as the official documentation:
APOLLO_FRAMEWORK_PATH="$(eval find $FRAMEWORK_SEARCH_PATHS -name "Apollo.framework" -maxdepth 1)"
if [ -z "$APOLLO_FRAMEWORK_PATH" ]; then
echo "error: Couldn't find Apollo.framework in FRAMEWORK_SEARCH_PATHS; make sure to add the framework to your project."
exit 1
fi
cd "${SRCROOT}/${TARGET_NAME}"
$APOLLO_FRAMEWORK_PATH/check-and-run-apollo-cli.sh codegen:generate --queries="$(find . -name '*.graphql')" --schema=schema.json API.swift
You need to install the Apollo CLI from Here Then try building your app again.

Has anyone gotten Electron to work in Tails?

Has anyone here got "electron" to work under tails distribution? Or any other download binary for that matter? I tried downloading the x64 binary
from the official site, but it won't execute it:
amnesia#amnesia:~/Desktop/temp$ ./electron --help
bash: ./electron: No such file or directory
I tried putting "bash" in front of it and I get a similar error:
amnesia#amnesia:~/Desktop/temp$ bash ./electron --help
./electron: ./electron: cannot execute binary file
I then installed npm and tried to install it from there and I'm getting the following error:
electron#1.6.6 postinstall /usr/local/lib/node_modules/electron
node install.js
sh: 1: node: Permission denied
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! electron#1.6.6 postinstall: `node install.js`
npm ERR! Exit status 127
npm ERR!
npm ERR! Failed at the electron#1.6.6 postinstall script.
npm ERR! This is most likely a problem with the electron package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls electron
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 4.8.0-0.bpo.2-amd64
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "electron"
npm ERR! cwd /home/amnesia/Desktop/prog
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/amnesia/Desktop/prog/npm-debug.log
npm ERR! not ok code 0
amnesia#amnesia:~/Desktop/prog$
Does tails somehow prevent downloaded binaries from executing? Are
there certain directories that don't allow executables? I am confused.
I am using tails 2.11
I was able to get electron to work in tails by downloading the "ia32" version of the binary. For some reason the electron x64 binary does not work, even though I am using the 64-bit version of tails.

npm error: tunneling socket could not be established, cause=connect ETIMEDOUT

I have an app that uses the Rails framework and implements AngularJs as part of the front end.
I have pushed everything to Heroku and have the Heroku Toolbelt installed, but when I try to migrate the db using "heroku run rake db:migrate" I receive the following error(s):
Installing core plugins heroku-cli-addons, heroku-apps, heroku-fork, heroku-git, heroku-local, heroku-run, heroku-status...
Error installing package. Try running again with GODE_DEBUG=info to see more output.
! `run` is not a heroku command.
! Perhaps you meant `-h`, `2fa`, `auth`, `join`, `open`, `orgs`, `pg`, `ps` or `rake`.
! See `heroku help` for a list of available commands.
I then run the command "GODE_DEBUG=info heroku run rake db:migrate" and receive this error:
npm ERR! Darwin 14.5.0
npm ERR! argv "/Users/Christopher_Pelnar/.heroku/node-v4.2.1-darwin-x64/bin/node" "/Users/Christopher_Pelnar/.heroku/node-v4.2.1-darwin-x64/lib/node_modules/npm/cli.js" "install" "heroku-cli-addons" "heroku-apps" "heroku-fork" "heroku-git" "heroku-local" "heroku-run" "heroku-status" "--loglevel=info"
npm ERR! node v4.2.1
npm ERR! npm v3.3.8
npm ERR! code ECONNRESET
npm ERR! network tunneling socket could not be established, cause=connect ETIMEDOUT 198.105.254.228:8080
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! Please include the following file with any support request:
npm ERR! /Users/Christopher_Pelnar/.heroku/npm-debug.log
Removing the proxy settings resolved the issue:
npm config rm proxy
npm config rm https-proxy
npm config set registry=http://registry.npmjs.org/
npm config set strict-ssl false
It's worked for me!

Resources