Check if npx command failed - jenkins-pipeline

When running npx, how can I tell if the command failed?
My specific use case is:
npx webdriver-manager update
This command fails frequently, but try enough times and it will eventually succeed. However npx seems to succeed regardless of whether the command succeeded or not, so how can I tell if webdriver-manager update was successful or not?
The end goal is to put this in a Jenkinsfile wrapped in a retry step, but that doesn't work if npx always "succeeds", so I have to indicate if the command failed in some other way.

Related

Jenkins giving "The cypress npm package is installed, but the Cypress binary is missing." error while Running cypress Test

Hi I am Trying to run cypress test through Jenkins and am getting the test form my local m/c not form github and am Executing windows batch command
"./node_modules/.bin/cypress run --spec "cypress\integration\SignUpTestCases\NewUserSignUp.spec.js" in Bulid configuration.
and i am getting this error
C:\Users\akash\CypressAutomation>./node_modules/.bin/cypress run --spec "cypress\integration\SignUpTestCases\NewUserSignUp.spec.js"
The cypress npm package is installed, but the Cypress binary is missing.
We expected the binary to be installed here: C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache\4.4.1\Cypress\Cypress.exe
Reasons it may be missing:
You're caching 'node_modules' but are not caching this path: C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache
You ran 'npm install' at an earlier build step but did not persist: C:\WINDOWS\system32\config\systemprofile\AppData\Local\Cypress\Cache
Properly caching the binary will fix this error and avoid downloading and unzipping Cypress.
Alternatively, you can run 'cypress install' to download the binary again.
https://on.cypress.io/not-installed-ci-error
WHat is the problem here .....or pls tell me about cypress configuration with Jenkins!!!!
Please set up environment variable CYPRESS_RUN_BINARY and its value should be your cypress runner location. (the runner defauly localtion is ~/AppData\Local\Cypress\Cache)
the variable setting:
Name: CYPRESS_RUN_BINARY
Value:C:\Users\Administrator\AppData\Local\Cypress\Cache\4.8.0\Cypress\Cypress.exe
Or you can add the command in the jenkins job:
set CYPRESS_RUN_BINARY=C:\Users\Administrator\AppData\Local\Cypress\Cache\4.8.0\Cypress\Cypress.exe before run the cypress cases.
Your problem probably exists because you have node_modules added to your git repository.
Remove node_modules folder from your repository
add node_modules to .gitignore file.
commit changes, push them and try again.

Cypress web automation - Cannot open Test Runner

I'm trying to open the Test Runner in cypress first time using the command node_modules.bin\cypress open
But I'm getting the following error.
Cypress verification timed out
Command failed "path"\cypress.exe\smoke test ping=948
I had tried all other open commands as well.
Could you help me with this?
I know this question was long ago, but I just had this problem, and in case anyone does in the future, I want to tell you how I solved it. In my case I had just installed Cypress in a project, and after running npm install the problem has been solved.

How to build some packet in tensorflow with debug mode\

I encountered the problem that I wanted to have a debug, then I wanted to build a debug version of tensorflow, using the following command:
bazel build --compilation_mode=dbg -s //tensorflow/tools/pip_package:build_pip_package
but it will trigger the longtime link in protobuf for almost oneday, and still not finished.
and my intension is to build some other package which is used by tensorflow with debug mode, could I configure the bazel build file to get some debug package separately?
To understand the issue better, try running the neverending action manually:
start the debug build, wait for it to get stuck in the protobuf linking action
interrupt the build (Ctrl+C)
run the build again with the -s flag, so Bazel shows the command line it executes (you could've ran step 1. with the -s flag, but then there's a lot more output and it's harder to find the right information)
interrupt the build again
cd into the directory shown in the by command and set environment variables
try running the command that failed (you may need to change the output paths because they are sometimes not user-writable) and see if it still never finishes
What you just did is running the same command Bazel was running and getting stuck on. If the command is stuck in this manual mode too, then the error might be with the linker (I doubt this is the case though). But if it succeeds, then the problem is with Bazel.

Why does running npm test result in: '.' is not recognized as an internal or external command, operable program or batch file.?

I have the following installed:
Windows 10
Git bash (mingw64)
Node.js v8.7.0
npm version 5.4.2
Packages:
chai 4.4.1
mocha 3.5.0
I have a sample mocha test that will always pass when it actually runs.
The command I'm running in my shell:
npm test
Output:
./node_modules/mocha/bin/_mocha
'.' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! Test failed. See above for more details.
For some reason I'm able to run this command directly:
./node_modules/mocha/bin/_mocha
Which results in
Sample Test
√ passes!
1 passing (4ms)
I'm guessing this has something to do with the weirdness of using a bash-like shell inside of windows, however I'm not sure how I can troubleshoot this from here.
Why might this error be happening, and is there a way to get 'npm test' to work properly without having to ditch using this windows programming environment?
Thanks & Regards
This may not be a perfect answer, but it fixes the issue in a way that is sufficient to continue developing:
in my package.json file I had:
"test" : "./node_modules/mocha/bin/_mocha"
Changing this to:
"test" : "node ./node_modules/mocha/bin/_mocha"
Made it so I could run npm test command fine.
I'm still unsure as to why the original value would not work since running that as a command in the shell works just fine.
If anyone sees this and wants to offer some insight that would be greatly appreciated.

Running r.js from through node.js within Rake causes a file lock error

I am using Rake to run the r.js optimizer within node. This is the rake command
sh %{node.exe lib/dist/requireJS/2.1.1/r.js -o app.build.js} do |ok, status|
ok or fail "r.js build failed"
end
This causes the following error
node.exe lib/dist/requireJS/2.1.1/r.js -o app.build.js
Error: EBUSY, resource busy or locked
at Object.fs.readSync (fs.js:381:19)
If I run the same command outside of rake at the command line I don't get the error. This looks like a file lock error, but I don't know what file is locked or why it is locked. Perhaps it is even a red herring. I would appreciate any insights that you may have.
Thanks in advance

Resources