Travis CI: npm install ERESOLVE


I received an npm install error for my Travis CI build after upgrading my dependencies:

$ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: @rollup/[email protected]
npm ERR! node_modules/@rollup/plugin-typescript
npm ERR!   dev @rollup/[email protected]"^6.1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev @rollup/[email protected]"^6.1.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/rollup
npm ERR!   peer [email protected]"^2.14.0" from @rollup/[email protected]
npm ERR!   node_modules/@rollup/plugin-typescript
npm ERR!     dev @rollup/[email protected]"^6.1.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /home/travis/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/travis/.npm/_logs/2020-11-08T01_13_40_933Z-debug.log

This started happening with npm v7 and I realized it’s related to build cache:

Setting up build cache

$ node --version
v15.1.0
$ npm --version
7.0.8
$ nvm --version
0.36.0

So I ended up disabling npm cache in .travis.yml to get a green build:

# .travis.yml
cache:
  npm: false


If you enjoyed this post, please consider supporting this site!