`dist/`文件夹在Vue中为空。

huangapple go评论72阅读模式
英文:

`dist/` Folder Empty on Vue

问题

免责声明

我想在开始这个问题之前声明,我是一个完全的网页开发初学者。

这个问题可能很愚蠢,所以感谢你看到它并回答它。

设置

我使用的是Node版本16.15.1和npm版本9.5.0。我通过运行$ npm create vite@latest创建了我的项目。然后我选择了Vue和Javascript。除了npm抱怨“deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead”之外,一切都运行良好。

我进入项目并运行了$ npm install,然后是$ npm run build。没有错误或警告出现。

问题

之后,我打开了dist/index.html,除了一个空白页面什么也没有。npm run dev似乎可以工作,但我找不到最终的网站在哪里。

我之前尝试了一次又一次,但结果都是一样的。

我做错了什么?

再次感谢任何花时间回答我的问题的人。

编辑:
我试图生成静态HTML,以便在类似Github Pages的地方使用。

英文:

Disclaimer

I just want to start this question by saying that I am a complete beginner to web dev.

This question might be stupid so thank you for looking at it and answering it.

Setup

I am on node version 16.15.1 and npm version 9.5.0. I created my project by running $ npm create vite@latest. I then choose Vue and Javascript. Other than npm complaining about "deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead" everything worked well.

I cded into the project and ran $ npm install and then $ npm run build. No errors or warnings occurred.

Problem

After this, I opened up dist/index.html and there was nothing except a blank page. npm run dev seems to work, but I can't find the final website anywhere.

I have previously tried again and again but I get the same results.

What am I doing wrong?

Again, I want to thank anyone who takes the time to answer my question.

Edit:
I am trying to generate static HTML for use in something like Github Pages.

答案1

得分: 0

你需要一个网络服务器来查看构建,不能只是在浏览器中打开 dist/index.html

要查看你的构建,可以在项目根目录中运行 npx serve dist

希望这有所帮助。

英文:

You will need a web server to see the build, you cant just open dist/index.html in a browser.

To view your build you can run npx serve dist from the root of your project.

Hope that helps.

huangapple
  • 本文由 发表于 2023年3月7日 22:51:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/75663528.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定