Alan Souza Alan Souza - 3 months ago 18
Node.js Question

Travis CI cache: ignore specific folder/file from cache

I have the following configuration in my

.travis.yml
:

language: node_js
node_js:
- '5.0.0'
sudo: false
cache:
bundler: true
directories:
- node_modules


One of my packages is a Github branch where content changes but version remains unchanged. What happens is that the cache is not invalidated, and there is nothing wrong at this point. But I wonder if there is a way to exclude a specific folder from the cache construction, something along these lines:

language: node_js
node_js:
- '5.0.0'
sudo: false
cache:
bundler: true
directories:
- node_modules
- !node_modules/grommet


Where
!node_modules/grommet
will be excluded from the cache index.

I tried using
before_cache
as described in here. But no luck.

Any help appreciated...

Answer

I had to reinstall the module manually. In your case, your travis.yml install section should look like this:

... install: - npm uninstall grommet - npm install