From 410ea688693a3252f89bb3f7079131e0fa6448e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=85=B7=E9=85=B7=E7=9A=84=E5=93=80=E6=AE=BF?= Date: Sun, 4 Oct 2020 14:17:38 +0800 Subject: [PATCH] Add throw err when we don https://github.com/hexojs/hexo-cli/issues/249 --- lib/find_pkg.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/find_pkg.js b/lib/find_pkg.js index 79fd3904..14028882 100644 --- a/lib/find_pkg.js +++ b/lib/find_pkg.js @@ -16,7 +16,12 @@ function checkPkg(path) { return readFile(pkgPath).then(content => { const json = JSON.parse(content); - if (typeof json.hexo === 'object') return path; + if (typeof json.hexo === 'object') { + return path + } + else { + throw "Can't find hexo in " + pkgPath; + }; }).catch(err => { if (err && err.code === 'ENOENT') { const parent = dirname(path);