about 40-50% of our builds fail on npm install due to the fact that circle is trying to use an ancient version of npm to install deps (1.1.70).
from the npm step in the circle UI:
npm ERR! node -v v4.2.4
npm ERR! npm -v 1.1.70
it is using the correct node version as listed in our circle.yml and saying that it’s using the correct npm during the set node.js version to 4 task:
Downloading https://nodejs.org/dist/v4.2.4/node-v4.2.4-linux-x64.tar.xz...
######################################################################## 100.0%
WARNING: checksums are currently disabled for node.js v4.0 and later
Now using node v4.2.4 (npm v2.14.12)
default -> 4 (-> v4.2.4)
We are not installing npm 1.1.70 (it’s not listed in our package.json), and we are not changing the path at all during install.
Rebuilding without cache always makes it use the correct npm version. Is there anyway to clear the cache for the project entirely and have it save a correctly built cache?
I’m still not sure what the underlying issue is here, but the output suggests that a locally installed version of npm is being used, so that explains why running npm install -g npm@2 does not help. My guess is that one of your dependencies is somehow installing this older version of npm as one of its dependencies. If you’re unable to figure out how to stop that from happening, you may be able to work around this by removing the -g flag from your npm install -g npm@2 command so that npm@2 is installed locally instead of globally.
There no NPM being installed in the node_modules tree for this branch of the project. Here is the output from npm ls npm:
npm ls npm
scripto@1.0.0 /Users/todd/src/scripto2
└── (empty)
And just to verify the command does what you want it to do, here’s the results for acorn which our app does not directly rely upon, but rather it a dependency of a dependency
Why is the version from another branch appearing in the restored cache (especially a version which build extremely infrequently) appearing in this branch’s cache. That gives me a large concern for build dependency issues if cached installs from other branches are polluting each other. If we were working on upgrading a module version how can we be sure if building a branch with a different version is not interfering with this?
So @frank – since we once had NPM installed on a branch that we haven’t built in over a month, we’re going to be stuck with this permanently in our cache?
We still have to choose rebuild without cache on every single new branch pushed up – branches that are based on a branch that does not include the old NPM dependency.
Is there anyway to make circle-ci drop this cached node_modules?
I know caching is one of those “hard” things from a computer science perspective, but this is pretty troubling if we’re getting back cached copies of node_modules from different branches that are super stale…