This is my config.yml file
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
machine:
services:
- mongodb
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:8.11.1
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
- image: circleci/mongo:3.4.15
working_directory: ~/repo
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: yarn install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
# run tests!
- run: yarn test
But whenever I run the build it exits with code 1 on CircleCI
With Error log as:
yarn run v1.5.1
$ nyc mocha --timeout 10000 --exit
19:56:59 - error: uncaughtException: Cannot find module 'Joi' date=Thu Sep 06 2018 19:56:59 GMT+0000
My package.json file seems to have JOI defined and also the test cases run fine on local machine.
{
"name": "crm-dcr-api",
"main": "server.js",
"repository": {
"type": "git",
"url": ""
},
"scripts": {
"start": "nodemon server.js",
"test": "nyc mocha --timeout 10000 --exit",
"test-coverage": "istanbul cover _mocha -- -u exports -R spec --exit",
"sync": "node ./jobs/",
"gulp": "gulp"
},
"author": "Sourav Lahoti",
"license": "MIT",
"dependencies": {
"app-module-path": "^2.2.0",
"async-redis": "^1.1.4",
"body-parser": "~1.18.2",
"cli-table": "^0.3.1",
"compression": "^1.7.3",
"express": "~4.16.1",
"g": "^2.0.1",
"getenv": "^0.7.0",
"gulp": "^3.9.1",
"gulp-mocha": "^5.0.0",
"https": "^1.0.0",
"joi": "^13.6.0",
"jsonwebtoken": "^8.2.1",
"lodash": "^4.17.10",
"mocha-junit-reporter": "^1.17.0",
"mongoose": "~4.11.14",
"morgan": "~1.9.0",
"node-fetch": "^2.1.2",
"node-schedule": "^1.3.0",
"nodemon": "^1.17.4",
"query-params-mongo": "^1.0.4",
"querystring": "^0.2.0",
"request": "^2.85.0",
"request-promise": "^4.2.2",
"winston": "^2.4.1"
},
"devDependencies": {
"chai": "^4.1.2",
"istanbul": "^0.4.5",
"mocha": "^5.0.5",
"nyc": "^11.6.0",
"supertest": "^3.0.0"
}
}