Skip to content

Commit

Permalink
fix(CLI): Correctly resolve version during local fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrzesik committed May 11, 2021
1 parent 3c5d713 commit bbfe742
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/cli/render-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ module.exports = async () => {
'Running "serverless" installed locally (in service node_modules)'
)}\n`
);
const localServerlessDir = path.resolve(path.dirname(localServerlessPath), '..');

try {
try {
require(path.resolve(localServerlessDir, 'bin/serverless.js'));
require(path.resolve(localServerlessPath, 'bin/serverless.js'));
} catch {
// Pass and attempt to use `bin/serverless` that was used by older version of the Framework
require(path.resolve(localServerlessDir, 'bin/serverless'));
require(path.resolve(localServerlessPath, 'bin/serverless'));
}
} catch {
// This is just a fallback as for most (all?) versions it shouldn't happen
Expand Down

0 comments on commit bbfe742

Please sign in to comment.