{"record":{"id":"d1b3c2a9f1232195","repo":"balderdashy/sails","slug":"trying-to-lift-app-using-a-local-copy-of-sails","errorCode":null,"errorMessage":"Trying to lift app using a local copy of `sails`","messagePattern":"Trying to lift app using a local copy of `sails`","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"errors/warn.js","lineNumber":21,"sourceCode":" */\n\nvar nodepath = require('path');\nvar CaptainsLog = require('captains-log');\n\n// Once per process:\n// Build logger using best-available information\n// when this module is initially required.\nvar rconf = require('../lib/app/configuration/rc')();\nvar log = CaptainsLog(rconf.log);\n\n\n/**\n * Warnings\n */\nmodule.exports = {\n\n  incompatibleLocalSails: function(requiredVersion, localVersion) {\n    log.warn('Trying to lift app using a local copy of `sails`');\n    log.warn('(located in ' + nodepath.resolve(process.cwd(), 'node_modules/sails') + ')');\n    log.warn();\n    log.warn('But the package.json in the current directory indicates a dependency');\n    log.warn('on Sails `' + requiredVersion + '`, and the locally installed Sails is `' + localVersion + '`!');\n    log.warn();\n    log.warn('If you run into compatibility issues, try installing ' + requiredVersion + ' locally:');\n    log.warn('    $ npm install sails@' + requiredVersion);\n    log.warn();\n    log.blank();\n  },\n\n\n\n  // Verbose-only warnings:\n\n  noPackageJSON: function() {\n    log.warn('Cannot read package.json in the current directory (' + process.cwd() + ')');\n    log.warn('Are you sure this is a Sails app?');","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/balderdashy/sails/blob/7b76422cc27823df033572bdda5c4910a68b697f/errors/warn.js#L3-L39","documentation":"This is a compatibility warning from Sails' errors/warn.js (incompatibleLocalSails). When lifting an app, the globally-installed Sails detects a local copy in node_modules/sails whose version does not match the version range declared in the app's package.json. It warns that the local copy will be used and suggests installing the required version locally.","triggerScenarios":"Running `sails lift` (global CLI) in a project whose node_modules/sails version is incompatible with the package.json dependency range, e.g. package.json requires ~0.12.x but node_modules has 1.0.0.","commonSituations":"Upgrading Sails globally but not locally (or vice versa); stale node_modules after editing package.json without reinstalling; multiple projects on one machine with different Sails versions.","solutions":["Install the version required by package.json: npm install sails@<requiredVersion> --save.","Run npm install to resync node_modules with package.json.","Delete node_modules/sails and package-lock.json, then reinstall.","Invoke the local sails binary (npx sails lift) so global/local versions stay decoupled."],"exampleFix":"// before (package.json)\n\"dependencies\": { \"sails\": \"^0.12.0\" } // local copy is 1.0.0\n// after\n\"dependencies\": { \"sails\": \"^1.0.0\" }\n// then: rm -rf node_modules && npm install","handlingStrategy":"validation","validationCode":"const pkg = require('./package.json');\nconst local = require('./node_modules/sails/package.json').version;\nif (!require('semver').satisfies(local, pkg.dependencies.sails)) { console.error('sails version mismatch: need ' + pkg.dependencies.sails + ', have ' + local); process.exit(1); }","typeGuard":"function sailsVersionMatches(depRange, localVersion) { try { return require('semver').satisfies(localVersion, depRange); } catch (e) { return false; } }","tryCatchPattern":"try { require('sails').lift(config); } catch (e) { if (/incompatibleLocalSails|version/i.test(e.message)) { console.error('Install matching sails version locally'); process.exit(1); } throw e; }","preventionTips":["Always install sails as a project dependency, not just globally.","Use npx sails lift to run the local binary.","Reinstall node_modules after changing the sails version range.","Pin sails versions in package.json and commit the lockfile."],"tags":["version-mismatch","installation","sails"],"backgroundTag":"dependency-version-mismatch","analyzedSha":"7b76422cc27823df033572bdda5c4910a68b697f","analyzedAt":"2026-09-01T04:01:57.104Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}