balderdashy/sails · warning

But the package.json in the current directory indicates a de

Error message

But the package.json in the current directory indicates a dependency

What it means

Second line of the `incompatibleLocalSails` warning banner in errors/warn.js. It tells the developer that the discrepancy was detected by comparing the dependency range in the current directory's package.json against the actual locally installed Sails version. It exists to point at the authoritative source (package.json) for the expected version.

Source

Thrown at errors/warn.js:24

var CaptainsLog = require('captains-log');

// Once per process:
// Build logger using best-available information
// when this module is initially required.
var rconf = require('../lib/app/configuration/rc')();
var log = CaptainsLog(rconf.log);


/**
 * Warnings
 */
module.exports = {

  incompatibleLocalSails: function(requiredVersion, localVersion) {
    log.warn('Trying to lift app using a local copy of `sails`');
    log.warn('(located in ' + nodepath.resolve(process.cwd(), 'node_modules/sails') + ')');
    log.warn();
    log.warn('But the package.json in the current directory indicates a dependency');
    log.warn('on Sails `' + requiredVersion + '`, and the locally installed Sails is `' + localVersion + '`!');
    log.warn();
    log.warn('If you run into compatibility issues, try installing ' + requiredVersion + ' locally:');
    log.warn('    $ npm install sails@' + requiredVersion);
    log.warn();
    log.blank();
  },



  // Verbose-only warnings:

  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();
  },

View on GitHub (pinned to 7b76422cc2)

Solutions

  1. Run `npm install` so the local sails matches the package.json range.
  2. Run `npm install sails@<requiredVersion>` with the exact version named in the warning.
  3. Verify with `npm ls sails` that only one sails version is installed and it satisfies the range.

Example fix

// before (terminal)
sails lift
// after
npm install sails@^1.5.0 && sails lift
Defensive patterns

Strategy: validation

Validate before calling

const semver = require('semver');
const pkg = require('./package.json');
const installed = require('sails/package.json').version;
if (!semver.satisfies(installed, pkg.dependencies.sails)) {
  console.error('Local sails does not satisfy package.json range; run npm install');
}

Prevention

When it happens

Trigger: Same as the banner start: `sails lift` runs while the local sails version fails to satisfy the semver range in ./package.json; the CLI prints this line with interpolated requiredVersion and localVersion on the following line.

Common situations: Editing package.json's sails range by hand without reinstalling; switching branches where package.json changed; installing sails with a pinned tag while package.json expects another range.

Related errors


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