travis-citravis-ci-cli

How to enable cache for node js in travis?


I'm trying to use bellow syntax:

cache:
  bundler: true
  directories:
    - foldername/foldername/node_modules 

After the build is done I see 11 MB of cache on the 'Cahes' page in Travis, but in real life node_modules is about 60 mb and I can't say that I have some perfomance improvment. Is it ok or maybe I'm doing something wrong?


Solution

  • This is how I have cached my folders for nodejs.

    # .travis.yml
    
    language: node_js
    
    node_js:
      - "stable"
    
    cache:
      directories:
        - node_modules
    

    Note: Folders located under directories are relative to the .travis.yml file.

    The official documentation has more information.