Skip to content

Commit

Permalink
Unbreak apps that reached a corrupted state due to #927
Browse files Browse the repository at this point in the history
Previously to fixing #927, if you had a 'node_modules' directory
anywhere up the directory tree from your app and you had a package
in your app using NPM, all calls to 'npm' ran against the 'node_modules'
directory it found, so neither 'node_modules' nor 'npm-shrinkwrap.json'
would be created within your package's .npm directory.

The fix to #927 ensured that 'node_modules' was first created within
'.npm' but people who had already run 0.6.0 were still in a corrupted state.
  • Loading branch information
avital committed Apr 8, 2013
1 parent dc783ba commit b904459
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tools/meteor_npm.js
Expand Up @@ -62,6 +62,19 @@ _.extend(exports, {
var newPackageNpmDir = packageNpmDir + '-new-' + self._randomToken();

try {
// v0.6.0 had a bug that could cause .npm directories to be
// created without npm-shrinkwrap.json
// (https://github.com/meteor/meteor/pull/927). Running your app
// in that state causes consistent "Corrupted .npm directory"
// errors.
//
// If you've reached that state, delete the empty directory and
// proceed.
if (fs.existsSync(packageNpmDir) &&
!fs.existsSync(path.join(packageNpmDir, 'npm-shrinkwrap.json'))) {
files.rm_recursive(packageNpmDir);
}

if (fs.existsSync(packageNpmDir)) {
// we already nave a .npm directory. update it appropriately with some ceremony involving:
// `npm install`, `npm install name@version`, `npm shrinkwrap`
Expand Down

0 comments on commit b904459

Please sign in to comment.