Travis CI NodeJs build runs locally but gets a permission denied on Travis

I run locally the mocha test inside my repo It works just fine but when I push a commit and it runs on travis CI I keep getting this error:

sh: 1: mocha: Permission denied

npm ERR! Test failed.  See above for more details.

here’s my package.json:

  "name": "skeletonapp",
  "version": "0.0.0",
  "description": "skeletonapp",
  "main": "index.js",
  "author": {
    "name": "li"
  "scripts": {
    "test": "mocha"
  "dependencies": {
    "chai": "^3.5.0",
    "mocha": "^3.1.2"

any help would be appreciated

Turn on the execute permission on node_modules/.bin, or remove node_modules from your Git repository, and let Travis install it with npm install.

1 Like

i made it executable thru chmod, and on /.bin worked great, thank u @montana

Glad I could help you in solving this.