{"record":{"id":"a1b82042c434d12c","repo":"balderdashy/sails","slug":"rm-rf-pathtolocalsails-npm-install-sails","errorCode":null,"errorMessage":"rm -rf ${pathToLocalSails} && npm install sails@${requiredVersion}","messagePattern":"rm -rf (.+?) && npm install sails@(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"errors/warn.js","lineNumber":55,"sourceCode":"  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  }\n};\n","sourceCodeStart":37,"sourceCodeEnd":59,"githubUrl":"https://github.com/balderdashy/sails/blob/7b76422cc27823df033572bdda5c4910a68b697f/errors/warn.js#L37-L59","documentation":"This is the second warning line of badLocalDependency in errors/warn.js: the concrete shell command Sails suggests to repair the broken local Sails install. It prints 'rm -rf <pathToLocalSails> && npm install sails@<requiredVersion>' so the developer can copy-paste the exact fix for the version Sails expects.","triggerScenarios":"Fires immediately after the 'You may consider running:' line whenever Sails detects a corrupted/missing/unparsable package.json in the local Sails dependency at pathToLocalSails.","commonSituations":"Same as the parent warning: botched installs, manually tampered node_modules/sails, partial restores from backup, or CI containers that copied node_modules between images with different Sails versions.","solutions":["Copy and run the printed command exactly: rm -rf <pathToLocalSails> && npm install sails@<requiredVersion>.","Then re-run npm install for the whole project and lift the app again.","Commit a correct package-lock.json so future installs resolve the right version."],"exampleFix":"// before\n$ sails lift   // warning about corrupted local Sails\n// after\n$ rm -rf node_modules/sails && npm install sails@1.5.3\n$ sails lift   // OK","handlingStrategy":"validation","validationCode":"const expected = require('./package.json').dependencies.sails;\nconst actual = (() => { try { return require('./node_modules/sails/package.json').version; } catch { return null; } })();\nif (actual !== expected) console.warn(`sails@${expected} expected but ${actual} found; run: rm -rf node_modules/sails && npm install sails@${expected}`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run the printed rm -rf + npm install command verbatim when it appears.","Pin the Sails version in package.json and regenerate the lockfile after upgrades.","Rebuild node_modules from scratch when switching Node versions or machines."],"tags":["node-modules","npm-install","repair-command","warning"],"backgroundTag":"corrupted-local-dependency","analyzedSha":"7b76422cc27823df033572bdda5c4910a68b697f","analyzedAt":"2026-09-01T04:01:57.104Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}