tea3 / hexo-related-popular-posts

A hexo plugin that generates a list of links to related posts and popular posts. Also , this plugin can get Visitor Counts (PV) on posts.
MIT License
109 stars 15 forks source link

Unhandled rejection TypeError: Cannot read property 'path' of undefined #15

Closed ApolloZhu closed 4 years ago

ApolloZhu commented 5 years ago

gaData[i] seems to be undefined in the following line of code:

https://github.com/tea3/hexo-related-popular-posts/blob/d9e7687fb6f34a8004cec099f6eb292ff8cae9bf/lib/collector.js#L205

I'm using Hexo 3.8.0, NexT 6.7.0, but this bug has been around for a quite a lot of other versions. As it doesn't impact the actual deployment, take your time to investigate, and happy new year.

Full error message ``` Unhandled rejection TypeError: Cannot read property 'path' of undefined at Promise (node_modules/hexo-related-popular-posts/lib/collector.js:205:31) at new Promise () at checkUpdate (node_modules/hexo-related-popular-posts/lib/collector.js:201:12) at module.exports (node_modules/hexo-related-popular-posts/lib/collector.js:8:12) at Hexo.hexo.extend.filter.register (node_modules/hexo-related-popular-posts/index.js:168:38) at Hexo.tryCatcher (node_modules/bluebird/js/release/util.js:16:23) at Hexo. (node_modules/bluebird/js/release/method.js:15:34) at Promise.each.filter (node_modules/hexo/lib/extend/filter.js:63:65) at tryCatcher (node_modules/bluebird/js/release/util.js:16:23) at Object.gotValue (node_modules/bluebird/js/release/reduce.js:155:18) at Object.gotAccum (node_modules/bluebird/js/release/reduce.js:144:25) at Object.tryCatcher (node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (node_modules/bluebird/js/release/promise.js:512:31) at Promise._settlePromise (node_modules/bluebird/js/release/promise.js:569:18) at Promise._settlePromise0 (node_modules/bluebird/js/release/promise.js:614:10) at Promise._settlePromises (node_modules/bluebird/js/release/promise.js:693:18) at Async._drainQueue (node_modules/bluebird/js/release/async.js:133:16) at Async._drainQueues (node_modules/bluebird/js/release/async.js:143:10) at Immediate.Async.drainQueues (node_modules/bluebird/js/release/async.js:17:14) at processImmediate (timers.js:632:19) ```

Should you need any other information to help you debug this problem, please let me know.

BrianYi commented 5 years ago

gaData[i] seems to be undefined in the following line of code:

https://github.com/tea3/hexo-related-popular-posts/blob/d9e7687fb6f34a8004cec099f6eb292ff8cae9bf/lib/collector.js#L205

I'm using Hexo 3.8.0, NexT 6.7.0, but this bug has been around for a quite a lot of other versions. As it doesn't impact the actual deployment, take your time to investigate, and happy new year.

Full error message Should you need any other information to help you debug this problem, please let me know.

when I push the button ctrl+s(save file) one more times, my server would print such messages as @ApolloZhu said, I just change several places and it works(I dont know js, but I find some useful tips), the changes as below(I'm not sure whether it will cause some underlying problems, it just worked for me) collector.js add 5 lines code image cache.js add 1 line code image

tea3 commented 5 years ago

@BrianYi Thanks for suggestion. As I corrected collector.js, please update npm version.