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

Update index.js #297

Closed
wants to merge 1 commit into from
Closed

Update index.js #297

wants to merge 1 commit into from

Conversation

zuck
Copy link

@zuck zuck commented Apr 29, 2018

Resolve TypeError if title is not a string.

Resolve TypeError if title is not a string.
@yyx990803
Copy link
Member

When does this happen? When submitting PRs, make sure to provide enough context so that we can determine whether this actually fixes the problem.

@ulivz
Copy link
Member

ulivz commented Apr 29, 2018

Please give enough context, thanks!

@zuck
Copy link
Author

zuck commented Apr 29, 2018

Yeah, sorry guys. I was trying to port an existing (working) project from Hexo to Vuepress.

Following the "getting started" guide I simply ran vuepress dev from root folder , receiving the following error:

TypeError: str.replace is not a function
    at parseEmojis (/usr/lib/node_modules/vuepress/lib/util/index.js:3:14)
    at exports.inferTitle (/usr/lib/node_modules/vuepress/lib/util/index.js:38:12)
    at Promise.all.options.pageFiles.map (/usr/lib/node_modules/vuepress/lib/prepare.js:193:19)
    at <anonymous>

Of course I can guess this is related to the fact the root folder of my existing Hexo project contains many different kind of files, but docs are a little bit vague about project structure for beginners.

@meteorlxy
Copy link
Member

meteorlxy commented Apr 30, 2018

I find what happened. I have ever met similar problem in another project.

If you set title in the frontmatter of a page (not home: true) to a pure Number value, it will try to call .replace() on a Number object, which leads to this error.

E.g. set the frontmatter of docs/config/README.md:

---
sidebar: auto
title: 233
---

Should be merged.

@ulivz
Copy link
Member

ulivz commented Apr 30, 2018

@znck Thanks for this PR, but with some conflict and not a complete fix.
@meteorlxy thanks for your investigation.

completely fixed at 5023d19

@ulivz ulivz closed this Apr 30, 2018
@znck
Copy link
Member

znck commented Apr 30, 2018

Not me @ulivz.

@zuck Thanks for the PR.

@ulivz ulivz mentioned this pull request May 11, 2018
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

Successfully merging this pull request may close these issues.

None yet

5 participants