Cannot build / run test properly in travis. Permission denied - node.js

I have a simple node.js code/project. I write some test with jestjs. I run the test on my local machine with the command 'npm run test'. The test is able to pass.
I moved the project onto GitHub and wanted to tinker with Travis CI. But my build on travis ci fails. The error message on travis is shown below.
Below is the state of my Git repo:
I never committed the folder 'node_modules' into Git because I read somewhere that this folder should be excluded as Travis would have its 'own environment to run and build the project'.
Below is my .travis.yml :
Below is my package.json file:
I tried modifying this file as well. I am still stuck, Should I remove the lines that states the "build" ?
Appreciate any help!

Maybe try adding the following to travis.yml
before_script: chmod 0555 ./node_modules/.bin/travis

I resolved the situation by adding the below:
before_script: chmod 0555 ./node_modules/.bin/jest
I think this is trying to tell the machine running to allow the use of the jest library. Therefore the jests unit test is able to run properly.

Related

The cypress npm package is installed, but the Cypress binary is missing (newbie)

I see many instances of this question but nothing that helps me. Apologies if this question gets boring.
I am just starting out with node.js, Cypress and GitLab Pipelines.
I've cobbled together something that has a simple web app, a few simple tests.
It ran fine the first time but, on subsequent commits, it fails at the 'Cypress Tests' step with: The cypress npm package is installed, but the Cypress binary is missing.
There's a lot more to the log but I don't know what is relevant.
Here is my yml file
cypress tests:
stage: test
image: cypress/browsers:node14.17.0-chrome91-ff89
cache:
key: package-lock.json
paths:
- node_modules
before_script:
- npm install
- npm run dev &
- ./node_modules/.bin/wait-on http://localhost:3000
script:
- npm run cypress
only:
- merge_requests
- master
Could you please help with anything that looks like it might be the culprit?
Or at least help me understand how to read the situation better?
I tried reading the docs as much as I can, I just can't see the right way.
I'm also a beginner but I'm trying to answer. First you can add "cypress:open" : "cypress open" to the file package.json. For more details you can watch this video

Plesk Git additional deploy actions npm not executed

I've connected Plesk to GitHub. Plesk gives the opportunity to run additional deployment actions after a branch was pulled. Pulling the branch works fine.
But it seems, that these actions are not triggered.
I want to run the install:prod task from my package.json file.
I can run this successfully via ssh.
I've also tried to skip the prepending "npm run" part but without success.
My current configuration looks like this.
npm run install:prod
The logs are showing no error message. It seems to silently fail.
I had the same problem. The solution for me was to use the correct path on the additional deploy scripts, you can find out those by doing "which npm" and "pwd" for getting your website dir path. Once you have those you could use this lines on your deploy scripts, for example, assuming "httpdocs" is where your website is:
cd /var/www/vhosts/<your vhost>/httpdocs
/usr/bin/npm run install:prod

All mocha tests pass locally but fail on Travis CI

I am building an api, everything works locally but on Travis-CI, the test fails. For the first time I was getting "mocha: permission denied". I deleted node_modules in my repository so that the Travis can install all dependacies with "npm install". And then I start getting this: enter image description here
Thanks for your help!
As you can see in picture that you have supplied on remote machine node --version is v0.10.48. In that version Node.js is not supporting ES6 syntax.
In your .travis.yml file you need to set node_js version on which you want to run tests like this:
node_js:
- 10
- 9
- 8
With this part your tests will be run on three version of Node.js. More information what you can put in .travis.yml you can find in official documentation.

Set up an xcode bot to build and deploy a nodejs express server

I am attempting to set up a xcode project and bot that will build a nodejs application on commit from a github repository and restart the server after the build completes. The bot is currently picking up on the repository changes but fails to build correctly.
I am using a xcode external build tool project that uses /bin/bash as the tool path and the working directory is set to the local repository path.
The bot's after integration script is something like,
npm install --production
npm run build
npm run server:restart
I am getting errors like [npm|node] is not recognized.
Just looking for some clarity to what I might be missing or what could be going wrong.
Add this to the beginning of your script and review the output:
which node
set | grep PATH
This will happen if node is not in your path, which may happen because build scripts have a pretty basic environment - they're not running as a normal user. You may need to add it to your PATH at the start of your build script.

Temporary files on Travis

I have a Javascript project which uses Grunt for build process, QUnit for tests, Blanket for code coverage and a custom Grunt task to convert coverage results into LCOV files, sended to Coveralls. Everything running on TravisCI.
the project : https://github.com/mistic100/jQuery-QueryBuilder
my Grunt task : https://github.com/mistic100/grunt-qunit-blanket-lcov
So what should happen is that npm test runs QUnit+Blanket tests in a PhantomJS process and in the meanwhile, coverage results are saved in .coverage-results/all.lcov.
After a successfull build, grunt coveralls sends this file to Coveralls.
And my problem is here, the task does not find the file, although when I test on my computer it does.
see the last Travis log: https://travis-ci.org/mistic100/jQuery-QueryBuilder#L389
The only thing I can think about is that the file, for some reason, is deleted once npm test is finished. Is it possible ?
edit
so this has nothing to do with Travis but with my Grunt task where I use absolute paths thinking it's relative paths (I still don't know why it doesn't append on Windows though)
The only thing I can think about is that the file, for some reason, is deleted once npm test is finished. Is it possible ?
No, lifecycle-wise the build artefacts are still present, when running after_success commands.
The gruntfile.js configures force true and defines path - no issue here.
This should work.
I would suggest to throw in some commands to check the folders and files on Travis.
- sudo ls -alh /home/travis/build/mistic100/jQuery-QueryBuilder/*
- sudo ls -alh /home/travis/build/mistic100/jQuery-QueryBuilder/.coverage-results/*
Maybe you spot a permission issue during folder and file creation.
But that's my only guess.

Resources