0

When running mocha with istanbul (istanbul cover _mocha) sometimes the message Error: Cannot find module './command' and I need to remove the node_modules folder and reinstall in order to make it work again.

So far I could not replicate the exact conditions of this happening, but is usually after after I ran several tests.

Mocha still works, and between my dependencies for testing (mocha,chai and istanbul) command module only appears as direct dependency in istanbul. Currently using "istanbul": "^0.4.5" and node 6.6.0

1 Answer 1

1

I have a feeling this may be due to your node_modules/.bin/ folder having files instead of the expected symlinks. This can happen by copying your repo to another directory with node_modules already installed. To fix, try this:

cd bad_repo_dir
rm -fr node_modules
cd ../good_repo_dir
cp -a node_modules ../bad_repo_dir
cd ../bad_repo_dir
npm test

This -a on the copy command tells it to duplicate attributes as well as symlinks, etc. Hope that helps!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.