poozhu / crawler-for-github-trending

🕷️ A node crawler for github trending.

Home Page:https://poozhu.cn/project-center/#/github-trending

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError trimStart is not a function

benbendemo opened this issue · comments

运行环境:
Node Version:v6.11.3
NPM Version:5.8.0
MacOS Version: 10.14.5

在Mac下运行提示报错:

Listening on port 3000!
TypeError: $(...).find(...).text(...).trimStart is not a function
at Object. (/Users/jacksonshawn/GitHub/Crawler-for-Github-Trending/index.js:16:55)
at initialize.exports.each (/Users/jacksonshawn/GitHub/Crawler-for-Github-Trending/node_modules/cheerio/lib/api/traversing.js:300:24)
at /Users/jacksonshawn/GitHub/Crawler-for-Github-Trending/index.js:13:32

将index.js程序里面“.trimStart().trimEnd()”修改为“.trim()”则不会有这个问题,请问是什么原因,可以帮忙解答一下?

node 版本太低了,这两个函数只支持10.0以上的版本,详见 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trimStart

@ZY2071 谢谢,升级Node.js到10.16.3,问题解决了,issue关闭吧。