{"record":{"id":"281e77734d99122a","repo":"balderdashy/sails","slug":"are-you-sure-this-is-a-sails-app","errorCode":null,"errorMessage":"Are you sure this is a Sails app?","messagePattern":"Are you sure this is a Sails app\\?","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"errors/warn.js","lineNumber":39,"sourceCode":"    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();\n  },\n\n  badLocalDependency: function(pathToLocalSails, requiredVersion) {\n    log.warn(\n      'The local Sails dependency installed at `' + pathToLocalSails + '` ' +\n      'has a corrupted, missing, or un-parsable package.json file.'\n    );\n    log.warn('You may consider running:');\n    log.warn('rm -rf ' + pathToLocalSails + ' && npm install sails@' + requiredVersion);\n    log.warn();\n  }","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/balderdashy/sails/blob/7b76422cc27823df033572bdda5c4910a68b697f/errors/warn.js#L21-L57","documentation":"Second line of the `noPackageJSON` warning (errors/warn.js:39), asking whether the current directory is really a Sails app. It follows the 'Cannot read package.json' line and prompts the developer to verify they are in a valid Sails project root.","triggerScenarios":"Same as errorIndex 105: `sails lift` executed where package.json cannot be read in process.cwd().","commonSituations":"Accidentally lifting in a scratch/empty directory; the app lives in a subdirectory (e.g. api/ or a nested workspace); package.json was gitignored or removed by a cleanup script.","solutions":["Verify the directory contains a Sails app (package.json with sails dependency + app.js + config/) and cd there before lifting.","Restore the missing package.json from version control (`git checkout -- package.json`).","If this is meant to be a Sails app, scaffold or re-init: `sails new .` or `npm install sails`."],"exampleFix":"// before\n~/tmp$ sails lift\n// after\ncd ~/projects/my-sails-app && sails lift","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nconst isSailsRoot = fs.existsSync('./package.json') && fs.existsSync('./config') && fs.existsSync('./app.js');\nif (!isSailsRoot) {\n  console.error('This does not look like a Sails app root; cd into the app directory.');\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify the Sails layout (package.json + app.js + config/) before lifting.","Restore package.json from git if it was deleted: `git checkout -- package.json`.","Avoid running sails commands from scratch/temp directories."],"tags":["sails","package-json","project-structure"],"backgroundTag":"missing-package-json","analyzedSha":"7b76422cc27823df033572bdda5c4910a68b697f","analyzedAt":"2026-09-01T04:01:57.104Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}