balderdashy/sails · warning

(located in NODE_MODULES_PATH/node_modules/sails)

Error message

(located in NODE_MODULES_PATH/node_modules/sails)

What it means

This is not an exception but a console warning emitted by Sails' logger (errors/warn.js, `incompatibleLocalSails`). Sails detected that the app was lifted with a locally installed `sails` (node_modules/sails resolved from CWD) whose version differs from the version range declared in the app's package.json. It is the first line of a multi-line banner explaining the mismatch and how to fix it.

Source

Thrown at errors/warn.js:22

var nodepath = require('path');
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 sails@<requiredVersion>` in the project root to align the local install with package.json.
  2. Run `npm install` to refresh node_modules against package.json.
  3. Update the package.json sails dependency to match the version you intend to use, then reinstall.
  4. Remove stale node_modules (`rm -rf node_modules && npm install`) if the lockfile and package.json disagree.

Example fix

// package.json before
"dependencies": { "sails": "^0.12.0" }
// after (then run npm install)
"dependencies": { "sails": "^1.5.0" }
Defensive patterns

Strategy: validation

Validate before calling

// scripts/check-sails-version.js (run before `sails lift`)
const pkg = require('./package.json');
const installed = require('sails/package.json').version;
const semver = require('semver');
if (!semver.satisfies(installed, pkg.dependencies.sails)) {
  console.error(`sails ${installed} does not satisfy ${pkg.dependencies.sails}; run: npm install sails@${pkg.dependencies.sails}`);
  process.exit(1);
}

Prevention

When it happens

Trigger: Running `sails lift` (or requiring the sails CLI) in a project directory where require('sails') resolves to a local node_modules/sails whose version does not satisfy the package.json dependency range; bin/sails calls warn.incompatibleLocalSails(requiredVersion, localVersion).

Common situations: Global sails CLI version differs from the project's installed sails; package.json was bumped (e.g. `^1.0.0` -> `^2.0.0`) without running npm install; node_modules is stale after a git pull; a globally hoisted sails is picked up from a parent node_modules.

Related errors


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