angular-cli“ng build"不产生一个工作项目? [英] angular-cli "ng build" doesn't produce a working project?

查看:26
本文介绍了angular-cli“ng build"不产生一个工作项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(我是 Angular2 星球上的新人(从垂死的星球移居
Flex/Actionscript,所以请原谅这个幼稚的问题)

我是否犯了一个致命的错误,认为在从 Angular CLi 对我的项目运行ng build"命令后,我最终会在目录dist"中得到一个正常运行的项目 - 其中我可以在浏览器中运行,在服务器上运行?

Have I made a fatal error in thinking that after running the "ng build" command on my project from Angular CLi, I would end up with a functioning project in the directory "dist" – which I could just run in a browser, put up on a server?

我最终得到了一个文件夹,里面装满了正确命名的东西等.这里有我遗漏的步骤吗?

I end up with a folder full of correctly named stuff, etc. Is there a step I am missing here?

推荐答案

我是 angular 的新手,刚遇到同样的问题.您可以直接从文件系统打开并在浏览器中运行 Index.html 文件,但您必须从以下位置编辑 Index.html 中 base href 属性的路径:

I'm new to angular, and just ran into the same issue. You can open up and run the Index.html file in the browser directly from the file system, but you have to edit the path of the base href attribute in Index.html from:

<base href="/">

到:

<base href="./">

这篇关于angular-cli“ng build"不产生一个工作项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆