Build passed 2 months ago; Same fails today

Today I cannot get my build to pass…
sh: 1: eslint: not found

If I comment out the lint command it fails on next…
sh: 1: mocha: not found

Weird thing is I reran a built that did pass 2 months ago and it fails today…
See #40


Could you please SSH into a container and run the commands manually and see if you are getting the same error.

Pawan Bahuguna

1 Like

Thanks for looking into this. When I SSH into the container and run the commands manually I get the same errors. I would have included images of tails of logs, but I am limited in the number of images I can include.

Here’s tail of first log file:

Here’s tail of second log file:

Could you please check if mocha and eslist set as devDependencies in package.json? Are you setting NODE_ENV=production or something else that is only installing regular dependencies?

Also, please try to use latest node image and let us know how it goes.

Pawan Bahuguna

1 Like


Thanks for responding quickly. Below are the answers to your questions/suggestions. Everything seems in order, but build fails.

  • eslint and mocha are devDependencies
    “eslint”: “^6.8.0”,
    “eslint-config-prettier”: “^5.1.0”,
    “eslint-plugin-prettier”: “^3.1.3”,
    “mocha”: “^6.2.3”,

  • I’m not using NODE_ENV.

  • I changed the image to circleci/node:10.16.0-buster-browsers

Limited on number of links I may provide in reply…Here are linked to package.json and config.yml

This was a bit of a puzzler! It looks like at some point, the node_modules directory was added to the git repository.

Because of this, the install was skipping for most of the dependencies. When the node_modules was committed, it did not have the .bin directory. It actually looks like node_modules/.bin was explicitly excluded in the .gitignore file

So to adjust this, I would follow this series of steps

  1. git rm -r node_modules
  2. git commit -m "Remove node_modules"
  3. Edit the .gitignore file and remove the entry node_modules/**/.bin/ and other node_modules exclusions
  4. Ignore the entire node_modules directory in the .gitignore with simply node_modules/
  5. git add .gitignore
  6. git commit -m "Ignore entire node_modules directory"
  7. Edit the .circleci/config.yml and increment the cache keys prefixes from v1 to v2
  8. git add .circleci/config.yml
  9. git commit -m "Increment CircleCI cache keys"
  10. git push origin master

That should now populate the node_modules/.bin directory which has the symlinks that are included in the $PATH environment variable when running scripts via npm run

Boom! Thanks for your help. This worked, though I had to increment cache to V3 since I already had V2 cache.