balderdashy/sails · warning
Are you sure this is a Sails app?
Error message
Are you sure this is a Sails app?
What it means
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.
Source
Thrown at errors/warn.js:39
log.warn('Trying to lift app using a local copy of `sails`');
log.warn('(located in ' + nodepath.resolve(process.cwd(), 'node_modules/sails') + ')');
log.warn();
log.warn('But the package.json in the current directory indicates a dependency');
log.warn('on Sails `' + requiredVersion + '`, and the locally installed Sails is `' + localVersion + '`!');
log.warn();
log.warn('If you run into compatibility issues, try installing ' + requiredVersion + ' locally:');
log.warn(' $ npm install sails@' + requiredVersion);
log.warn();
log.blank();
},
// Verbose-only warnings:
noPackageJSON: function() {
log.warn('Cannot read package.json in the current directory (' + process.cwd() + ')');
log.warn('Are you sure this is a Sails app?');
log.warn();
},
notSailsApp: function() {
log.warn('The package.json in the current directory does not list Sails as a dependency...');
log.warn('Are you sure `' + process.cwd() + '` is a Sails app?');
log.warn();
},
badLocalDependency: function(pathToLocalSails, requiredVersion) {
log.warn(
'The local Sails dependency installed at `' + pathToLocalSails + '` ' +
'has a corrupted, missing, or un-parsable package.json file.'
);
log.warn('You may consider running:');
log.warn('rm -rf ' + pathToLocalSails + ' && npm install sails@' + requiredVersion);
log.warn();
}View on GitHub (pinned to 7b76422cc2)
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`.
Example fix
// before ~/tmp$ sails lift // after cd ~/projects/my-sails-app && sails lift
Defensive patterns
Strategy: validation
Validate before calling
const fs = require('fs');
const isSailsRoot = fs.existsSync('./package.json') && fs.existsSync('./config') && fs.existsSync('./app.js');
if (!isSailsRoot) {
console.error('This does not look like a Sails app root; cd into the app directory.');
process.exit(1);
} Prevention
- 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.
When it happens
Trigger: Same as errorIndex 105: `sails lift` executed where package.json cannot be read in process.cwd().
Common situations: 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.
Related errors
- The package.json in the current directory does not list Sail
- But the package.json in the current directory indicates a de
- Cannot read package.json in the current directory (CWD)
- Cannot call res.render() - `req._sails.renderView` was not a
- The 2-ary usage of `res.redirect()` is no longer supported i
AI-assisted analysis of balderdashy/sails@7b76422cc2 (2026-09-01).
Data as JSON: /api/errors/281e77734d99122a.
Report an issue: GitHub.