cometlj / hexo-translate-title

使用Google翻译,百度翻译和有道翻译将Hexo文章中的汉字标题转成英文标题
https://cometlj.github.io
Other
43 stars 17 forks source link

hexo加载hexo-translate-title出错 #11

Closed arleyzhang closed 6 years ago

arleyzhang commented 6 years ago

ERROR Plugin load failed: hexo-translate-title D:\myBlog\node_modules\hexo-translate-title\index.js:7 hexo.extend.filter.register('before_post_render', async function (data) { ^^^^^ SyntaxError: missing ) after argument list

一直说有语法错误,少了个右括号,但是我又没改源码,打开源码看了一下,发现也不少括号,但就是报错,烦人

arleyzhang commented 6 years ago

完整的错误信息 ··· ERROR Plugin load failed: hexo-translate-title D:\myBlog\node_modules\hexo-translate-title\index.js:7 hexo.extend.filter.register('before_post_render', async function (data) { ^^^^^

SyntaxError: missing ) after argument list at createScript (vm.js:56:10) at Object.runInThisContext (vm.js:97:10) at D:\myBlog\node_modules\hexo\lib\hexo\index.js:230:17 at tryCatcher (D:\myBlog\node_modules\bluebird\js\release\util.js:16:23) at Promise._settlePromiseFromHandler (D:\myBlog\node_modules\bluebird\js\release\promise.js:512:31) at Promise._settlePromise (D:\myBlog\node_modules\bluebird\js\release\promise.js:569:18) at Promise._settlePromise0 (D:\myBlog\node_modules\bluebird\js\release\promise.js:614:10) at Promise._settlePromises (D:\myBlog\node_modules\bluebird\js\release\promise.js:693:18) at Promise._fulfill (D:\myBlog\node_modules\bluebird\js\release\promise.js:638:18) at Promise._resolveCallback (D:\myBlog\node_modules\bluebird\js\release\promise.js:432:57) at Promise._settlePromiseFromHandler (D:\myBlog\node_modules\bluebird\js\release\promise.js:524:17) at Promise._settlePromise (D:\myBlog\node_modules\bluebird\js\release\promise.js:569:18) at Promise._settlePromise0 (D:\myBlog\node_modules\bluebird\js\release\promise.js:614:10) at Promise._settlePromises (D:\myBlog\node_modules\bluebird\js\release\promise.js:693:18) at Promise._fulfill (D:\myBlog\node_modules\bluebird\js\release\promise.js:638:18) at D:\myBlog\node_modules\bluebird\js\release\nodeback.js:42:21 at D:\myBlog\node_modules\graceful-fs\graceful-fs.js:78:16 at tryToString (fs.js:457:3) at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:444:12) ···

arleyzhang commented 6 years ago

问题已解决,是node版本的问题,升级一下版本就可以了,感谢作者的工作 https://github.com/cometlj/hexo-translate-title/issues/6

cometlj commented 6 years ago

node版本最好升级为>=8以上的LTS或者stable版,详见hexo官网