简体   繁体   English

在没有任何服务器的浏览器中将Angular 5应用程序作为静态网站运行

[英]Run Angular 5 app as static website in browser without any server

I have requirement to run Angular 5 application in browser by opening index.html file in browser manually. 我要求通过在浏览器中手动打开index.html文件在浏览器中运行Angular 5应用程序。 My client does not have any server. 我的客户端没有任何服务器。 He just want me to send him a package(dist folder) and simply double click on index.html file to run the application as a website in the browser. 他只希望我向他发送一个软件包(dist文件夹),然后只需双击index.html文件即可在浏览器中将其作为网站运行。

I am done with ng build --prod --base-href ./ and i have files in my dist folder. 我已经完成了ng build --prod --base-href ./并且我的dist文件夹中有文件。 I can't use any server Node/IIS because I can't ask my client to do install these servers as a prerequisite. 我不能使用任何服务器Node / IIS,因为我不能要求客户端安装这些服务器作为先决条件。

There is no way to do that. 没有办法做到这一点。 But you can install http-server packge on client's machine and just run http-server dist/ in your prod build directory. 但是,您可以在客户端计算机上安装http-server packge,然后仅在产品构建目录中运行http-server dist /。

npm install -g http-server

http-server dist/

hope this helps 希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在没有浏览器的网站上运行javascript - Run javascript on website without browser 如何在没有浏览器同步和节点的情况下运行Angular 2应用程序? - How to run Angular 2 app without browser-sync and node? 我们可以在没有任何服务器的浏览器中运行我们的 webpack (UI) 构建吗? - Can we run our webpack (UI) build just like that in an browser without any server? 如何在不打开浏览器的情况下在服务器中运行Slimmerjs? - How to run Slimmerjs in a server without opening a browser? 将 Angular 应用作为 Express Server 中的静态内容提供服务 - Serving Angular app as a static content in Express Server 如何从服务器中使用新的js和html刷新Angular应用,但不重新加载浏览器窗口 - How to refresh an angular app with new js and html from the server, but without reloading the browser window 注销后如何在不使用浏览器缓存的情况下从服务器重新加载角度应用程序 - How to reload angular app from server, without using browser cache, after logout 角度指令未加载模板,静态应用程序(无服务器) - angular directive is not loading template, static app ( no server ) 运行nodejs静态网站 - Run nodejs static website Apache Cordova:运行cordova无需启动浏览器应用程序即可运行浏览器 - Apache Cordova: running cordova run browser without launching browser app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM