Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop calling moduleDoesResolve before installing Cordova npm deps.
This fixes the bug where commands like `meteor add-platform ios` would fail the first time with an error that cordova-lib could not be found, even though we attempt to install the necessary packages if they have not already been installed. To make a very long story short, calling moduleDoesResolve before installing dependencies like cordova-lib was causing Node.js to cache the _absence_ of cordova-lib/package.json permanently in the new packageJsonCache, which cannot be invalidated or cleared by user code: https://github.com/nodejs/node/blob/f8f20892e944a6c4b52e298528135161d85fcc7a/lib/internal/modules/cjs/loader.js#L245-L255 Although we could potentially propose a change to Node to allow the packageJsonCache to be invalidated, a more immediate solution is simply to avoid calling moduleDoesResolve when there's any chance the module will not resolve. Because we still want to avoid repeatedly installing Cordova dependencies every time we run a Cordova command, we instead check whether the necessary dependencies are installed by examining the file system.
- Loading branch information