{"record":{"id":"5852ea7367e954be","repo":"balderdashy/sails","slug":"npm-install-sails-required-version","errorCode":null,"errorMessage":"    $ npm install sails@REQUIRED_VERSION","messagePattern":"    \\$ npm install sails@REQUIRED_VERSION","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"errors/warn.js","lineNumber":28,"sourceCode":"// 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?');\n    log.warn();\n  },\n\n  notSailsApp: function() {\n    log.warn('The package.json in the current directory does not list Sails as a dependency...');\n    log.warn('Are you sure `' + process.cwd() + '` is a Sails app?');\n    log.warn();","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/balderdashy/sails/blob/7b76422cc27823df033572bdda5c4910a68b697f/errors/warn.js#L10-L46","documentation":"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.","triggerScenarios":"Same trigger as the whole banner: `sails lift` with a local sails version not satisfying package.json's range.","commonSituations":"Developers ignoring the prose above and just wanting the fix command; onboarding a project with an outdated lockfile.","solutions":["Run the printed command verbatim (without the leading $) in the app root.","Restart the lift: `sails lift` and confirm the warning is gone.","If using yarn/pnpm, run the equivalent (`yarn add sails@<version>` / `pnpm add sails@<version>`)."],"exampleFix":"// before (shell)\n$ sails lift\n// after\n$ npm install sails@^1.5.0\n$ sails lift","handlingStrategy":"validation","validationCode":"// .github/workflows or shell precheck\nnode -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)\"); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy the suggested command verbatim from the warning output.","After reinstall, confirm with `npm ls sails` that the warning disappears on the next lift.","Bootstrap new clones with a documented `npm install && sails lift` step."],"tags":["sails","npm-install","version-mismatch","shell"],"backgroundTag":"sails-local-sails-version-mismatch","analyzedSha":"7b76422cc27823df033572bdda5c4910a68b697f","analyzedAt":"2026-09-01T04:01:57.104Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}