Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
Have travis cache the npm cache instead of node_modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalton committed Aug 10, 2016
1 parent 905e22b commit 85ad21b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ node_js:
- "6"
cache:
directories:
- node_modules
- $HOME/.npm
env:
global:
- BIN="node" ISTANBUL=false
Expand Down Expand Up @@ -33,7 +33,6 @@ before_install:
- "npm set loglevel error"
- "npm set progress false"
- "npm i -g npm@\"^2.0.0\""
- "npm prune && npm update --dev"
script:
- "[ $ISTANBUL == false ] || (istanbul cover -x \"**/vendor/**\" --report lcovonly ./test/test.js && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage) || true"
- "[ $ISTANBUL == true ] || cd ./test"
Expand Down

3 comments on commit 85ad21b

@balupton
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @jdalton what exactly is the benefit of this change? I've seen several projects now doing this, and consequently have asked why on Stack Overflow - http:https://stackoverflow.com/q/42521884/130638

@jdalton
Copy link
Member Author

@jdalton jdalton commented on 85ad21b Mar 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@balupton Hi!

I noticed caching the node_modules folder caused problems (build fails) while caching the .npm cache avoided it. I believe it's because the .npm cache doesn't store compiled native modules while the node_modules folder does. So when you test different versions of Node, as is common in Travis-CI, it will try to load a native module compiled for say Node 4 in Node 6 and barf.

@balupton
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jdalton okay that makes sense. Want to add that to the SO question, and I'll mark it as the answer - thanks so much!

Please sign in to comment.