{"record":{"id":"2ff2b7eddfd7bbe8","repo":"balderdashy/sails","slug":"but-the-package-json-in-the-current-directory-indi","errorCode":null,"errorMessage":"But the package.json in the current directory indicates a dependency","messagePattern":"But the package\\.json in the current directory indicates a dependency","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"errors/warn.js","lineNumber":24,"sourceCode":"var 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?');\n    log.warn();\n  },\n","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/balderdashy/sails/blob/7b76422cc27823df033572bdda5c4910a68b697f/errors/warn.js#L6-L42","documentation":"Second line of the `incompatibleLocalSails` warning banner in errors/warn.js. It tells the developer that the discrepancy was detected by comparing the dependency range in the current directory's package.json against the actual locally installed Sails version. It exists to point at the authoritative source (package.json) for the expected version.","triggerScenarios":"Same as the banner start: `sails lift` runs while the local sails version fails to satisfy the semver range in ./package.json; the CLI prints this line with interpolated requiredVersion and localVersion on the following line.","commonSituations":"Editing package.json's sails range by hand without reinstalling; switching branches where package.json changed; installing sails with a pinned tag while package.json expects another range.","solutions":["Run `npm install` so the local sails matches the package.json range.","Run `npm install sails@<requiredVersion>` with the exact version named in the warning.","Verify with `npm ls sails` that only one sails version is installed and it satisfies the range."],"exampleFix":"// before (terminal)\nsails lift\n// after\nnpm install sails@^1.5.0 && sails lift","handlingStrategy":"validation","validationCode":"const semver = require('semver');\nconst pkg = require('./package.json');\nconst installed = require('sails/package.json').version;\nif (!semver.satisfies(installed, pkg.dependencies.sails)) {\n  console.error('Local sails does not satisfy package.json range; run npm install');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat package.json as the source of truth; never bump the range without reinstalling.","Use `npm ci` in CI to guarantee installs match the lockfile.","Run `npm outdated sails` periodically to catch drift early."],"tags":["sails","package-json","version-mismatch","npm"],"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"}