build(travis): travis cache and nvm install hotfix #8623
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Well, this is interesting. The nvm/node-related changes introduced in #8617 made master fail when merged (but not in the PR). This seems to be a combination of issues with travis cache purging and nvm doing poor version presence checking.
What's happening is with travis uncached
"${HOME}/.nvm/versions/node/v$(< .nvmrc)"
:Notice how
(npm v...)
is not present. That comes from this:npm_has
is justtype "${1-}" > /dev/null 2>&1
. Sonpm
isn't there, which is correct, since travis cache is empty. Or is it?Why would
nvm install
report 8.9.1 (from our.nvmrc
) already installed?It's just a directory exist check. But it's empty:
And
nvm
isn't warning against this. Instead it happily reportsnode
is installed and doesn't do anything else. It should be checking for an executable${HOME}/.nvm/versions/node/v8.9.1/bin/node
instead.Clearing the cache should in theory remove the entire
"${HOME}/.nvm/versions/node/v$(< .nvmrc)"
. But despite purging travis cache via the web UI, this empty folder still persists.The temporary hotfix is to remove that dir if it's empty so
nvm install
can populate the cache.If
nvm install
is changed so that it better detects the presence of a node version as suggested above, then we don't need this hotfix.