Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

报错TypeError: tmpPost.categories.join is not a function #13

Closed
vio1etus opened this issue Aug 26, 2019 · 6 comments
Closed

报错TypeError: tmpPost.categories.join is not a function #13

vio1etus opened this issue Aug 26, 2019 · 6 comments

Comments

@vio1etus
Copy link

hexo g 时报错,卸载掉hexo-auto-category 就没事儿,所以应该还是它的问题,想问问该怎么办?
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html TypeError: tmpPost.categories.join is not a function at Hexo.logic (D:\hexo\blog\node_modules\hexo-auto-category\lib\logic.js:33:55) at Hexo.tryCatcher (D:\hexo\blog\node_modules\bluebird\js\release\util.js:16:23) at Hexo.<anonymous> (D:\hexo\blog\node_modules\bluebird\js\release\method.js:15:34) at Promise.each.filter (D:\hexo\blog\node_modules\hexo\lib\extend\filter.js:60:50) at tryCatcher (D:\hexo\blog\node_modules\bluebird\js\release\util.js:16:23) at Object.gotValue (D:\hexo\blog\node_modules\bluebird\js\release\reduce.js:155:18) at Object.gotAccum (D:\hexo\blog\node_modules\bluebird\js\release\reduce.js:144:25) at Object.tryCatcher (D:\hexo\blog\node_modules\bluebird\js\release\util.js:16:23) at Promise._settlePromiseFromHandler (D:\hexo\blog\node_modules\bluebird\js\release\promise.js:517:31) at Promise._settlePromise (D:\hexo\blog\node_modules\bluebird\js\release\promise.js:574:18) at Promise._settlePromise0 (D:\hexo\blog\node_modules\bluebird\js\release\promise.js:619:10) at Promise._settlePromises (D:\hexo\blog\node_modules\bluebird\js\release\promise.js:699:18) at _drainQueueStep (D:\hexo\blog\node_modules\bluebird\js\release\async.js:138:12) at _drainQueue (D:\hexo\blog\node_modules\bluebird\js\release\async.js:131:9) at Async._drainQueues (D:\hexo\blog\node_modules\bluebird\js\release\async.js:147:5) at Immediate.Async.drainQueues [as _onImmediate] (D:\hexo\blog\node_modules\bluebird\js\release\async.js:17:14) at runCallback (timers.js:705:18) at tryOnImmediate (timers.js:676:5) at processImmediate (timers.js:658:5)

@xu-song
Copy link
Owner

xu-song commented Aug 27, 2019

你打开文件 D:\hexo\blog\node_modules\hexo-auto-category\lib\logic.js

加一行代码测试看看呢?

        // 3.2 prevents duplicate file changes
        log.i(tmpPost.categories);   // 添加这一行,打印看看
        if (tmpPost.categories && (tmpPost.categories.join("_") == newCategories.join("_"))) return data;
        tmpPost.categories = newCategories

@vio1etus
Copy link
Author

除了之前的报错,还打印出了我的一些博文的文件夹信息.我是每个文件夹下有一些博文,为啥有的文件夹打印好多次?
$ hexo g INFO Start processing INFO [ 'computer_network' ] INFO hexo INFO [ 'php' ] INFO [ 'sql_injection' ] INFO [ 'sql_injection' ] INFO [ 'sql_injection' ] INFO [ 'sql_injection' ] INFO [ 'sql_injection' ] INFO [ 'sql_injection' ] INFO [ 'sql_injection' ] INFO [ 'sql_injection' ] INFO [ 'sql_injection' ] INFO [ 'sql_injection' ] INFO [ 'sql_injection' ] INFO [ 'sql_injection' ] INFO [ 'sql_injection' ] INFO [ 'wireshark' ] INFO [ 'wireshark' ] INFO [ 'computer_network' ] INFO [ 'php' ] INFO [ 'php' ] INFO [ 'sql_injection' ] INFO [ 'sql_injection' ] INFO [ 'sql_injection' ] INFO [ 'wireshark' ] INFO [ 'wireshark' ] INFO [ 'xss' ] INFO [ 'xss' ] INFO [ 'wireshark' ] INFO [ 'wireshark' ] INFO [ 'xss' ] INFO [ 'sql_injection' ] INFO [ 'xss' ] INFO [ 'wireshark' ] INFO [ 'sql_injection' ] INFO [ 'file upload' ] FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html TypeError: tmpPost.categories.join is not a function at Hexo.logic (D:\hexo\blog\node_modules\hexo-auto-category\lib\logic.js:34:55) at Hexo.tryCatcher (D:\hexo\blog\node_modules\bluebird\js\release\util.js:16:23) at Hexo.<anonymous> (D:\hexo\blog\node_modules\bluebird\js\release\method.js:15:34) at Promise.each.filter (D:\hexo\blog\node_modules\hexo\lib\extend\filter.js:60:50) at tryCatcher (D:\hexo\blog\node_modules\bluebird\js\release\util.js:16:23) at Object.gotValue (D:\hexo\blog\node_modules\bluebird\js\release\reduce.js:155:18) at Object.gotAccum (D:\hexo\blog\node_modules\bluebird\js\release\reduce.js:144:25) at Object.tryCatcher (D:\hexo\blog\node_modules\bluebird\js\release\util.js:16:23) at Promise._settlePromiseFromHandler (D:\hexo\blog\node_modules\bluebird\js\release\promise.js:517:31) at Promise._settlePromise (D:\hexo\blog\node_modules\bluebird\js\release\promise.js:574:18) at Promise._settlePromise0 (D:\hexo\blog\node_modules\bluebird\js\release\promise.js:619:10) at Promise._settlePromises (D:\hexo\blog\node_modules\bluebird\js\release\promise.js:699:18) at _drainQueueStep (D:\hexo\blog\node_modules\bluebird\js\release\async.js:138:12) at _drainQueue (D:\hexo\blog\node_modules\bluebird\js\release\async.js:131:9) at Async._drainQueues (D:\hexo\blog\node_modules\bluebird\js\release\async.js:147:5) at Immediate.Async.drainQueues [as _onImmediate] (D:\hexo\blog\node_modules\bluebird\js\release\async.js:17:14) at runCallback (timers.js:705:18) at tryOnImmediate (timers.js:676:5) at processImmediate (timers.js:658:5)

@xu-song
Copy link
Owner

xu-song commented Aug 27, 2019

看不出来什么原因,再打印一下 type呢?

log.i(typeof(tmpPost.categories));
log.i(tmpPost.categories);  

@vio1etus
Copy link
Author

嗯,打印之后是:
$ hexo g INFO Start processing INFO object INFO [ 'computer_network' ] INFO string INFO hexo INFO object INFO [ 'php' ] INFO object INFO [ 'sql_injection' ] INFO object INFO [ 'sql_injection' ] INFO object INFO [ 'sql_injection' ] INFO object INFO [ 'sql_injection' ] INFO object INFO [ 'sql_injection' ] INFO object INFO [ 'sql_injection' ] INFO object INFO [ 'sql_injection' ] INFO object INFO [ 'sql_injection' ] INFO object INFO [ 'sql_injection' ] INFO object INFO [ 'sql_injection' ] INFO object INFO [ 'sql_injection' ] INFO object INFO [ 'sql_injection' ] INFO object INFO [ 'sql_injection' ] INFO object INFO [ 'wireshark' ] INFO object INFO [ 'wireshark' ] INFO object INFO [ 'computer_network' ] INFO object INFO [ 'php' ] INFO object INFO [ 'php' ] INFO object INFO [ 'sql_injection' ] INFO object INFO [ 'sql_injection' ] INFO object INFO [ 'sql_injection' ] INFO object INFO [ 'wireshark' ] INFO object INFO [ 'wireshark' ] INFO object INFO [ 'xss' ] INFO object INFO [ 'xss' ] INFO object INFO [ 'wireshark' ] INFO object INFO [ 'wireshark' ] INFO object INFO [ 'xss' ] INFO object INFO [ 'sql_injection' ] INFO object INFO [ 'xss' ] INFO object INFO [ 'wireshark' ] INFO object INFO [ 'sql_injection' ] INFO object

@xu-song
Copy link
Owner

xu-song commented Aug 27, 2019

是不是因为出现了一个string类型
INFO string INFO hexo
哪来的呢,

@vio1etus
Copy link
Author

谢谢大神, 成功解决. 我把对应那个 hexo 文件夹下的博文的原来自己写的 categories 删除掉,就好了耶. 我看好像是我那里的 categories 格式不太对, 所以报错了. 谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants