cometlj / hexo-translate-title

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

ERROR Plugin load failed: hexo-translate-title Cannot find module 'request' #5

Closed itning closed 6 years ago

itning commented 6 years ago
ERROR Plugin load failed: hexo-translate-title
Error: Cannot find module 'request'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (G:\ProjectData\WebstormProjects\itningblog\node_modules\hexo-translate-title\lib\util.js:5:17)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (G:\ProjectData\WebstormProjects\itningblog\node_modules\hexo\lib\hexo\index.js:219:21)
    at G:\ProjectData\WebstormProjects\itningblog\node_modules\hexo-translate-title\index.js:5:12
    at fs.readFile.then.script (G:\ProjectData\WebstormProjects\itningblog\node_modules\hexo\lib\hexo\index.js:232:12)
    at tryCatcher (G:\ProjectData\WebstormProjects\itningblog\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (G:\ProjectData\WebstormProjects\itningblog\node_modules\bluebird\js\release\promise.js:512:31)
    at Promise._settlePromise (G:\ProjectData\WebstormProjects\itningblog\node_modules\bluebird\js\release\promise.js:569:18)
    at Promise._settlePromise0 (G:\ProjectData\WebstormProjects\itningblog\node_modules\bluebird\js\release\promise.js:614:10)
    at Promise._settlePromises (G:\ProjectData\WebstormProjects\itningblog\node_modules\bluebird\js\release\promise.js:693:18)
    at Promise._fulfill (G:\ProjectData\WebstormProjects\itningblog\node_modules\bluebird\js\release\promise.js:638:18)
    at Promise._resolveCallback (G:\ProjectData\WebstormProjects\itningblog\node_modules\bluebird\js\release\promise.js:432:57)
    at Promise._settlePromiseFromHandler (G:\ProjectData\WebstormProjects\itningblog\node_modules\bluebird\js\release\promise.js:524:17)

版本信息:

hexo: 3.7.1
hexo-cli: 1.1.0
os: Windows_NT 10.0.16299 win32 x64
http_parser: 2.8.0
node: 8.11.1
v8: 6.2.414.50
uv: 1.19.1
zlib: 1.2.11
ares: 1.10.1-DEV
modules: 57
nghttp2: 1.25.0
openssl: 1.0.2o
icu: 60.1
unicode: 10.0
cldr: 32.0
tz: 2017c

这段代码是不是忘记注释掉了? https://github.com/cometlj/hexo-translate-title/blob/master/lib/util.js#L5

xxzj990 commented 6 years ago

@itning npm install --save request

cometlj commented 6 years ago

你好,因为使用了async/await,所以默认使用了request-promise库,看贴的错误是ERROR Plugin load failed: hexo-translate-title,是插件没有加载成功错误。试试重新安装下插件

npm install hexo-translate-title -S