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: this.relative_url is not a function #20

Closed
joezimjs opened this issue Jan 14, 2016 · 9 comments
Closed

TypeError: this.relative_url is not a function #20

joezimjs opened this issue Jan 14, 2016 · 9 comments

Comments

@joezimjs
Copy link

This issue was originally raised on the Hexo repo (hexojs/hexo#1680), but it doesn't appear to be their fault. The issue was created in 8e3dc69 in lines 37-46 of lib/renderer.js. By calling url_for with the given ctx as the context, it is breaking the call to this.relative_url in Hexo's code: https://github.com/hexojs/hexo/blob/master/lib/plugins/helper/url_for.js#L28

I don't really know what the solution is, but this clearly isn't the correct context to use.

@ngerritsen
Copy link

+1, same issue here

@leesei
Copy link
Member

leesei commented Jan 31, 2016

Confirmed, use 0.2.7 for now.
The PR also seems not to work as expected #18.

@Xuanwo
Copy link

Xuanwo commented Feb 25, 2016

0.2.9 has reverted the pr, this should be fixed.
If anything happen, please create a new issue.
And sorry for guys, I merged the pr and broke so much things, 😞

@leesei
Copy link
Member

leesei commented Feb 25, 2016

8e3dc69 reverted

@leesei leesei closed this as completed Feb 25, 2016
@michaelbrooks
Copy link

I'm still seeing this issue with 0.2.10 if relative_link is true and a root is set.

@pcgrenier
Copy link

I would really like 8e3dc69 also added back as a ticket because it was a bug that needs fixing. Thanks

@NoahDragon
Copy link
Member

@pcgrenier Could you please create a new issue and describe the bug?

@connor11528
Copy link

connor11528 commented Aug 12, 2017

When I have relative_link: true in my config.yml file and I run the hexo dev server I get the following error when compiling all of my markdown blog posts:

ERROR Process failed: _posts/ES6-arrow-functions-and-this.md
TypeError: this.relative_url is not a function
    at Hexo.urlForHelper (/Users/connorleech/Projects/connor11528-blog/node_modules/hexo/lib/plugins/helper/url_for.js:28:17)
    at Model._Document.Document.<anonymous> (/Users/connorleech/Projects/connor11528-blog/node_modules/hexo/lib/models/post.js:60:31)
    at Model._Document.Document.permalink (/Users/connorleech/Projects/connor11528-blog/node_modules/warehouse/lib/types/virtual.js:70:22)
    at Model._Document.Document.Document.toObject (/Users/connorleech/Projects/connor11528-blog/node_modules/warehouse/lib/document.js:79:42)
    at Database._Model.Model.Model._insertOne (/Users/connorleech/Projects/connor11528-blog/node_modules/warehouse/lib/model.js:189:21)
    at /Users/connorleech/Projects/connor11528-blog/node_modules/warehouse/lib/model.js:214:17
    at tryCatcher (/Users/connorleech/Projects/connor11528-blog/node_modules/bluebird/js/release/util.js:16:23)
    at /Users/connorleech/Projects/connor11528-blog/node_modules/bluebird/js/release/using.js:185:26
    at tryCatcher (/Users/connorleech/Projects/connor11528-blog/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/connorleech/Projects/connor11528-blog/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/Users/connorleech/Projects/connor11528-blog/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/Users/connorleech/Projects/connor11528-blog/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/Users/connorleech/Projects/connor11528-blog/node_modules/bluebird/js/release/promise.js:693:18)
    at Promise._fulfill (/Users/connorleech/Projects/connor11528-blog/node_modules/bluebird/js/release/promise.js:638:18)
    at PromiseArray._resolve (/Users/connorleech/Projects/connor11528-blog/node_modules/bluebird/js/release/promise_array.js:126:19)
    at PromiseArray._promiseFulfilled (/Users/connorleech/Projects/connor11528-blog/node_modules/bluebird/js/release/promise_array.js:144:14)
    at Promise._settlePromise (/Users/connorleech/Projects/connor11528-blog/node_modules/bluebird/js/release/promise.js:574:26)
    at Promise._settlePromise0 (/Users/connorleech/Projects/connor11528-blog/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/Users/connorleech/Projects/connor11528-blog/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/Users/connorleech/Projects/connor11528-blog/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/Users/connorleech/Projects/connor11528-blog/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/Users/connorleech/Projects/connor11528-blog/node_modules/bluebird/js/release/async.js:17:14)

Also referenced in: hexojs/hexo#1680

@NoahDragon
Copy link
Member

@connor11528 We have a fix, but haven't release yet. hexojs/hexo#2668
You could get the latest hexo from the main repo, I think the issue should resolve.

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

8 participants