Node modules are not found during test phase

Hello,

This is an odd error that happens when npm test and npm run build are executed on circleci during the test phase. The environment complains that the packages are not found. The build works fine locally, and I don’t see any obvious answers as to why these modules aren’t available on the circleci’s side. Please see below:

Also, cicleci complains after running ‘npm run build’ that it can’t find the rimraf package, which should be apart of the node_modules package. Any thoughts on why circleci can’t read the node_modules folder?

Thanks in advance!

I answered my own question:

If you set your NPM environment to production, be mindful that NPM won’t install any packages that are listed in devDependencies inside your package.json file. You will need to ensure that the modules you need are listed in the regular dependencies listing.

As per the NPM docs:
With the --production flag (or when the NODE_ENV environment variable is set to production), npm will not install modules listed in devDependencies.

1 Like