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

示例不能访问且demo在无法运行,https://docsify.now.sh/ #7

Open
thinkido opened this issue Oct 12, 2020 · 7 comments
Open

Comments

@thinkido
Copy link

启动项目后续显示正常,访问http://localhost:4000后,控制台就报错。

D:\workspace\ssrDemo>npm start

[email protected] start D:\workspace\ssrDemo
docsify start . -c ssr.config.js

[SSR] Serving . now.
Listening at http://localhost:4000

TypeError: Cannot read property 'indexOf' of undefined
at AbstractHistory.parse (D:\workspace\ssrDemo\node_modules\docsify-server-renderer\build.js:267:27)
at Compiler.compile (D:\workspace\ssrDemo\node_modules\docsify-server-renderer\build.js:813:37)
at Renderer. (D:\workspace\ssrDemo\node_modules\docsify-server-renderer\build.js:1384:28)
at Generator.next ()
at c (D:\workspace\ssrDemo\node_modules\docsify-server-renderer\build.js:16:99)
at processTicksAndRejections (internal/process/task_queues.js:97:5)

@brightzoe
Copy link

npm start 在package.json里对应的是docsify start .
在docsify start后面对应的应该是你的docs的路径。

如果把docs/与package.json 放在同一级,你启动项目的cli应该是 docsify start ./docs ,修改package.json的对应片段即可。

@thinkido
Copy link
Author

thinkido commented May 8, 2021

npm start 在package.json里对应的是docsify start .
在docsify start后面对应的应该是你的docs的路径。

如果把docs/与package.json 放在同一级,你启动项目的cli应该是 docsify start ./docs ,修改package.json的对应片段即可。

可以出个动图或视频吗?这个项目在本地无法运行。你说的docs在文档,和这个项目中都没有提到。

TypeError: Cannot read property 'indexOf' of undefined
    at AbstractHistory.parse (D:\workspace\docsify_ssr\node_modules\docsify-server-renderer\build.js:297:27)
    at Compiler.compile (D:\workspace\docsify_ssr\node_modules\docsify-server-renderer\build.js:857:37)
    at Renderer.<anonymous> (D:\workspace\docsify_ssr\node_modules\docsify-server-renderer\build.js:1431:28)
    at Generator.next (<anonymous>)
    at c (D:\workspace\docsify_ssr\node_modules\docsify-server-renderer\build.js:16:99)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

@thinkido
Copy link
Author

thinkido commented May 8, 2021

初步判断是一个bug:
line857: this$1.router.parse().file;
Line:294

AbstractHistory.prototype.parse = function parse (path) {
    var query = '';

    var queryIndex = path.indexOf('?');

Line1327: this.router = new AbstractHistory(config);
第一行中没有传递参数,

@thinkido
Copy link
Author

thinkido commented May 8, 2021

在文档 docsify/ssr.md at develop · docsifyjs/docsify 中有说明,但是这个demo项目是无法运行的。
docsify源码中执行npm run serve:ssr 和 npm run dev:ssr 也不行,

@thinkido
Copy link
Author

thinkido commented May 8, 2021

github中搜索其他人的代码,找到了可以直接运行的demo。
workspace/server.js at 8528d0fae03e74a94d447212d328d3dd8579acc6 · zhaobohao/workspace

@thinkido
Copy link
Author

thinkido commented May 8, 2021

从其他人的代码中看到只是简单的把json字符添加到htrml,不是真实的html。官方demo 链接访问不了,如果不是渲染成seo可以爬取的 md ->text div -dom。那也就不用耗费几个小时尝试跑通demo了。

@ruanqizhen
Copy link

应该把这个demo删掉,否则浪费大家时间。

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

No branches or pull requests

3 participants