Build fails with error: Cannot find module '../pack.js'


#1

Hi I have suddenly started getting an error with my builds:

$ node --version
v10.10.0
$ npm --version
6.4.0
$ nvm --version
0.33.11
5.58s$ npm ci
npm WARN prepare removing existing node_modules/ before installation
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module '../pack.js'

Where do I look for the issue? My local builds are working perfectly.

Thanks in advance.


#2

Found it. Looks like my node_modules cache was not matching my latest dependencies. I am disabling all caching - reliability is more important to me than caching!


#3

Wondering if there is a way to force the cache to clear rather than removing caching? (Ran into the same issue)


#4

On the caches page for a Travis project (https://travis-ci.com/ORG_NAME/REPO_NAME/caches), there is a list of all the caches by branch and PR for the repository with a delete button to remove individual branch/PR caches, along with a Delete all repository caches button on the upper right of the page.

An alternative to deleting caches manually as needed might be to detect when the version for a dependency has changed, and have a script run that uninstalls/removes the cached dependency then reinstalls it.