{"record":{"id":"fe95ed15b54df77d","repo":"balderdashy/sails","slug":"located-in-node-modules-path-node-modules-sails","errorCode":null,"errorMessage":"(located in NODE_MODULES_PATH/node_modules/sails)","messagePattern":"\\(located in NODE_MODULES_PATH/node_modules/sails\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"errors/warn.js","lineNumber":22,"sourceCode":"\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?');\n    log.warn();","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/balderdashy/sails/blob/7b76422cc27823df033572bdda5c4910a68b697f/errors/warn.js#L4-L40","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Run `npm install sails@<requiredVersion>` in the project root to align the local install with package.json.","Run `npm install` to refresh node_modules against package.json.","Update the package.json sails dependency to match the version you intend to use, then reinstall.","Remove stale node_modules (`rm -rf node_modules && npm install`) if the lockfile and package.json disagree."],"exampleFix":"// package.json before\n\"dependencies\": { \"sails\": \"^0.12.0\" }\n// after (then run npm install)\n\"dependencies\": { \"sails\": \"^1.5.0\" }","handlingStrategy":"validation","validationCode":"// scripts/check-sails-version.js (run before `sails lift`)\nconst pkg = require('./package.json');\nconst installed = require('sails/package.json').version;\nconst semver = require('semver');\nif (!semver.satisfies(installed, pkg.dependencies.sails)) {\n  console.error(`sails ${installed} does not satisfy ${pkg.dependencies.sails}; run: npm install sails@${pkg.dependencies.sails}`);\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run `npm install` after pulling changes that touched package.json.","Pin the sails version consistently between global tooling and project dependencies.","Add a prelift script (`npm run prelift`) that validates installed version vs package.json.","Commit package-lock.json so installs are reproducible."],"tags":["sails","version-mismatch","dependency","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"}