balderdashy/sails · warning

on Sails `REQUIRED_VERSION`, and the locally installed Sails

Error message

on Sails `REQUIRED_VERSION`, and the locally installed Sails is `LOCAL_VERSION`!

What it means

Third line of the `incompatibleLocalSails` banner (errors/warn.js:25), showing the concrete versions: the required semver range from package.json (REQUIRED_VERSION) and the actually installed local Sails version (LOCAL_VERSION). It makes the mismatch explicit so the developer can decide whether to change package.json or the installed package.

Source

Thrown at errors/warn.js:25

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

  notSailsApp: function() {

View on GitHub (pinned to 7b76422cc2)

Solutions

  1. Run `npm install sails@<requiredVersion>` using the required version shown in this warning.
  2. Or change package.json's sails range to match the installed version if that version is intended.
  3. Run `npm outdated sails` to see the drift and update deliberately.

Example fix

// terminal, before
sails lift   // prints: required ^0.12.0, installed 1.5.3
// after
npm install sails@0.12.0
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
const local = JSON.parse(fs.readFileSync('./node_modules/sails/package.json', 'utf8'));
console.log('required:', pkg.dependencies.sails, '| installed:', local.version);

Prevention

When it happens

Trigger: Emitted during `sails lift` when warn.incompatibleLocalSails(requiredVersion, localVersion) is invoked because the local sails version does not satisfy the package.json range.

Common situations: Upgrading to a new Sails major without reinstalling; using an app scaffolded with an older Sails under a newer global CLI; CI cache restoring an old node_modules.

Related errors


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