Open cvz6 opened 3 years ago
reopen
先打开吧,方便后来人查看
感觉跑不了呀$
vuepress dev docs --temp .temp
wait Extracting site metadata...
tip Apply theme @vuepress/theme-default ...
tip Apply plugin container (i.e. "vuepress-plugin-container") ...
tip Apply plugin @vuepress/register-components (i.e. "@vuepress/plugin-register-components") ...
tip Apply plugin @vuepress/active-header-links (i.e. "@vuepress/plugin-active-header-links") ...
tip Apply plugin @vuepress/search (i.e. "@vuepress/plugin-search") ...
tip Apply plugin @vuepress/nprogress (i.e. "@vuepress/plugin-nprogress") ...
tip Apply plugin vuepress-plugin-yuque ...
tip Apply plugin @vuepress/medium-zoom (i.e. "@vuepress/plugin-medium-zoom") ...
error @vuepress/internal-site-config apply additionalPages failed.
FetchError: request to https://raw.githubusercontent.com/ulivz/vuepress-plugin-yuque/master/CHANGELOG.md failed, reason: getaddrinfo ENOENT raw.githubusercontent.com
at ClientRequest.
好吧,因为这个破项目 学会了nodejs和vue。。。。一入node深似海
感觉跑不了呀$ vuepress dev docs --temp .temp wait Extracting site metadata... tip Apply theme @vuepress/theme-default ... tip Apply plugin container (i.e. "vuepress-plugin-container") ... tip Apply plugin @vuepress/register-components (i.e. "@vuepress/plugin-register-components") ... tip Apply plugin @vuepress/active-header-links (i.e. "@vuepress/plugin-active-header-links") ... tip Apply plugin @vuepress/search (i.e. "@vuepress/plugin-search") ... tip Apply plugin @vuepress/nprogress (i.e. "@vuepress/plugin-nprogress") ... tip Apply plugin vuepress-plugin-yuque ... tip Apply plugin @vuepress/medium-zoom (i.e. "@vuepress/plugin-medium-zoom") ... error @vuepress/internal-site-config apply additionalPages failed. FetchError: request to https://raw.githubusercontent.com/ulivz/vuepress-plugin-yuque/master/CHANGELOG.md failed, reason: getaddrinfo ENOENT raw.githubusercontent.com at ClientRequest. (E:\坚果云同步\6.0 好好学习\1.0 网站开发学习\vue 网站\资源网站\vuepress-plugin-yuque-master\node_modules\node-fetch\lib\index.js:1461:11) at ClientRequest.emit (events.js:315:20) at TLSSocket.socketErrorListener (_http_client.js:426:9) at TLSSocket.emit (events.js:315:20) at emitErrorNT (internal/streams/destroy.js:92:8) at emitErrorAndCloseNT (internal/streams/destroy.js:60:3) at processTicksAndRejections (internal/process/task_queues.js:84:21) error Command failed with exit code
遇到相同问题
好吧,自问自答 既然没人回应,我自己改。。。 作为一名java coder,没写过nodejs,竟也半google,半看nodejs,给改好了 哈哈哈哈
clone了源码,修改了几个地方:
报错Language does not exist undefined,各种查询 无果 自己翻源码,发现是node_modules/prismjs/components/index.js 的,是个warn,prismjs是代码美化的插件,应该是我的markdown没指明代码类型 直接写的
而不是
java 这样,本来想不关了,反正warn,但是打印超级烦,还是想办法给它去了! 源码然后发现nodejs没有那种js加载顺序,像java可以在根目录写一个一样包名的类,jvm就会先加载我写的java文件,nodejs没有这种机制,所以我直接改的node_module源码,反正也解决了吧
vuepress 转换md文件各种报错,一堆错误,我就不粘贴了 修复bug,lib/index.js 应该取markdown类型的内容,现在取的html类型的,自然报错! 源码片段如下,直接取data.body || ''就可以了,不用判断 参考语雀的官方文档:https://www.yuque.com/yuque/developer/docdetailserializer![image](https://user-images.githubusercontent.com/19989280/95847185-fe64ee80-0d7e-11eb-8c57-fe0a2920fbe0.png)
缓存机制不友好,我的知识库500多篇文档,下载一次需要7、8分钟,不能忍受,查看源码发现作者使用conf插件变相实现了缓存,我改成了使用文件系统实现,直接把下载的json存到某目录下,可以查看,方便调试,然后html有问题的话,可以写另一个插件批量修改 去掉他的缓存
改为 文档id+最后修改时间为key标识,只下载修改了的文档
//获取一个知识库的目录结构 https://www.yuque.com/yuque/developer/repo#488246f2 //返回值:https://www.yuque.com/yuque/developer/repo#Response-4
yuque.js中修改下载文档的代码 // todo 更具slug和update_at 取最后更新的文件 //文档不更新则不下载 async getPage(slug, updated_at) { let time = new Date(updatedat).getTime(); let dirFile = `${dir}\json\${slug}${time}.json` //slug+update_at 标识文件唯一性,存在则直接返回硬盘文件,不再下载 //不存在则去语雀下载然后 保存到磁盘 if (fs.existsSync(dirFile)) { let str = fs.readFileSync(dirFile, 'utf8'); return JSON.parse(str); } else { const {status, data} = await Yuque.getPage(this.base, this.repoId, slug); console.log("下载文件:" + slug) let page = { status: status, data: data }; await Yuque.writeFile(dirFile, JSON.stringify(page, null, "\t")); return page; } }