balderdashy/sails · warning

$ npm install sails@REQUIRED_VERSION

Error message

    $ npm install sails@REQUIRED_VERSION

What it means

Fifth line of the `incompatibleLocalSails` banner (errors/warn.js:28): the literal copy-paste-ready shell command `$ npm install sails@REQUIRED_VERSION` that fixes the local/global Sails version mismatch. It is the actionable tail of the warning.

Source

Thrown at errors/warn.js:28

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

View on GitHub (pinned to 7b76422cc2)

Solutions

  1. Run the printed command verbatim (without the leading $) in the app root.
  2. Restart the lift: `sails lift` and confirm the warning is gone.
  3. If using yarn/pnpm, run the equivalent (`yarn add sails@<version>` / `pnpm add sails@<version>`).

Example fix

// before (shell)
$ sails lift
// after
$ npm install sails@^1.5.0
$ sails lift
Defensive patterns

Strategy: validation

Validate before calling

// .github/workflows or shell precheck
node -e "const s=require('sails/package.json').version,r=require('./package.json').dependencies.sails;process.exit(require('semver').satisfies(s,r)?0:1)" || { echo 'Fixing sails version'; npm install sails@$(node -e "console.log(require('./package.json').dependencies.sails)"); }

Prevention

When it happens

Trigger: Same trigger as the whole banner: `sails lift` with a local sails version not satisfying package.json's range.

Common situations: Developers ignoring the prose above and just wanting the fix command; onboarding a project with an outdated lockfile.

Related errors


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