LuxDL / DocumenterVitepress.jl

Documentation with Documenter.jl and VitePress
https://luxdl.github.io/DocumenterVitepress.jl/
MIT License
62 stars 9 forks source link

[vite]: Rollup failed to resolve import "assets/cumulative_budgets.png" from "/home/runner/work/PACKAGE_NAME.jl/PACKAGE_NAME.jl/docs/build/.documenter/index.md" #120

Closed shayandavoodii closed 1 month ago

shayandavoodii commented 2 months ago

Could you please help me with this error: https://github.com/shayandavoodii/OnlinePortfolioSelection.jl/actions/runs/8895424510/job/24425728076#step:6:54 Here is the link to the related branch: https://github.com/shayandavoodii/OnlinePortfolioSelection.jl/tree/Vitepress

This is the error I got when I tried to build the docs locally:

E:\Julia Forks\OPS.jl\docs>npm run docs:dev

> docs:dev
> vitepress dev build/.documenter

failed to start server. error:
Error: ENOENT: no such file or directory, lstat 'E:\Julia Forks\OPS.jl\docs\build\.documenter'
    at Object.realpathSync (node:fs:2702:29)
    at windowsSafeRealPathSync (file:///E:/Julia%20Forks/OPS.jl/docs/node_modules/vite/dist/node/chunks/dep-C-KAszbv.js:12590:17)
    at getRealPath (file:///E:/Julia%20Forks/OPS.jl/docs/node_modules/vite/dist/node/chunks/dep-C-KAszbv.js:47444:20)
    at getFsUtils (file:///E:/Julia%20Forks/OPS.jl/docs/node_modules/vite/dist/node/chunks/dep-C-KAszbv.js:47160:29)
    at preAliasPlugin (file:///E:/Julia%20Forks/OPS.jl/docs/node_modules/vite/dist/node/chunks/dep-C-KAszbv.js:49643:21)
    at resolvePlugins (file:///E:/Julia%20Forks/OPS.jl/docs/node_modules/vite/dist/node/chunks/dep-C-KAszbv.js:50359:9)
    at resolveConfig (file:///E:/Julia%20Forks/OPS.jl/docs/node_modules/vite/dist/node/chunks/dep-C-KAszbv.js:68250:30)
    at async _createServer (file:///E:/Julia%20Forks/OPS.jl/docs/node_modules/vite/dist/node/chunks/dep-C-KAszbv.js:64503:20)
    at async createDevServer (file:///E:/Julia%20Forks/OPS.jl/docs/node_modules/vitepress/dist/node/cli.js:403:20)
avik-pal commented 2 months ago

You are probably trying to display an image in the markdown https://github.com/shayandavoodii/OnlinePortfolioSelection.jl/actions/runs/8895424510/job/24425728076#step:6:47 which doesn't exist in that path

shayandavoodii commented 2 months ago

which doesn't exist in that path

Which path?

I got it. This one assets/cumulative_budgets.png you meant.

shayandavoodii commented 2 months ago

You are probably trying to display an image in the markdown https://github.com/shayandavoodii/OnlinePortfolioSelection.jl/actions/runs/8895424510/job/24425728076#step:6:47 which doesn't exist in that path

I changed the path from assets/cumulative_budgets.png to:

<img src="src/assets/cumulative_budgets.png" width="100%">

For GitHub actions, the former error exists as before. Locally, when I want to build the documentation, I get the following 404 Error: image

asinghvi17 commented 2 months ago

That won't work, this looks like some kind of path error. Am looking into it locally.

Specifically, Vitepress is looking in ../assets when it should be looking in assets.

asinghvi17 commented 2 months ago

@shayandavoodii it looks like you're using a pretty strange way of including images. That's why the loading doesn't work (that plus your HTML tags weren't closed).

In this case, you should include your images in the standard Markdown format:

![alt-text](path/to/image)

and it will work automatically.

I've tested that on my machine and the docs seem to build fine.

Can you test that and get back as to whether it works or not for you? If so then I can close the issue here.

shayandavoodii commented 2 months ago

Thank you so much. I used ![alt-text](assets/performance_eval.png) in the docs\src\performance_eval.md and ![alt-text](assets/cumulative_budgets.png) in docs\src\index.md. Yet, the 404 error is shown when I try to test it locally. What's the problem?

However, it seems that the problem is solved on GitHub actions: https://github.com/shayandavoodii/OnlinePortfolioSelection.jl/actions/runs/8900200497/job/24441242896#step:6:56

asinghvi17 commented 1 month ago

Might be because of the base URL that's set when dev'ing locally.