balderdashy/sails · warning

rm -rf ${pathToLocalSails} && npm install sails@${requiredVe

Error message

rm -rf ${pathToLocalSails} && npm install sails@${requiredVersion}

What it means

This is the second warning line of badLocalDependency in errors/warn.js: the concrete shell command Sails suggests to repair the broken local Sails install. It prints 'rm -rf <pathToLocalSails> && npm install sails@<requiredVersion>' so the developer can copy-paste the exact fix for the version Sails expects.

Source

Thrown at errors/warn.js:55

  noPackageJSON: function() {
    log.warn('Cannot read package.json in the current directory (' + process.cwd() + ')');
    log.warn('Are you sure this is a Sails app?');
    log.warn();
  },

  notSailsApp: function() {
    log.warn('The package.json in the current directory does not list Sails as a dependency...');
    log.warn('Are you sure `' + process.cwd() + '` is a Sails app?');
    log.warn();
  },

  badLocalDependency: function(pathToLocalSails, requiredVersion) {
    log.warn(
      'The local Sails dependency installed at `' + pathToLocalSails + '` ' +
      'has a corrupted, missing, or un-parsable package.json file.'
    );
    log.warn('You may consider running:');
    log.warn('rm -rf ' + pathToLocalSails + ' && npm install sails@' + requiredVersion);
    log.warn();
  }
};

View on GitHub (pinned to 7b76422cc2)

Solutions

  1. Copy and run the printed command exactly: rm -rf <pathToLocalSails> && npm install sails@<requiredVersion>.
  2. Then re-run npm install for the whole project and lift the app again.
  3. Commit a correct package-lock.json so future installs resolve the right version.

Example fix

// before
$ sails lift   // warning about corrupted local Sails
// after
$ rm -rf node_modules/sails && npm install sails@1.5.3
$ sails lift   // OK
Defensive patterns

Strategy: validation

Validate before calling

const expected = require('./package.json').dependencies.sails;
const actual = (() => { try { return require('./node_modules/sails/package.json').version; } catch { return null; } })();
if (actual !== expected) console.warn(`sails@${expected} expected but ${actual} found; run: rm -rf node_modules/sails && npm install sails@${expected}`);

Prevention

When it happens

Trigger: Fires immediately after the 'You may consider running:' line whenever Sails detects a corrupted/missing/unparsable package.json in the local Sails dependency at pathToLocalSails.

Common situations: Same as the parent warning: botched installs, manually tampered node_modules/sails, partial restores from backup, or CI containers that copied node_modules between images with different Sails versions.

Related errors


AI-assisted analysis of balderdashy/sails@7b76422cc2 (2026-09-01). Data as JSON: /api/errors/a1b82042c434d12c. Report an issue: GitHub.