如何在 tomcat 服务器(Windows Server 2012)上部署 Angular 2 应用程序 [英] How can I deploy an Angular 2 application on tomcat server (Windows Server 2012)

查看:22
本文介绍了如何在 tomcat 服务器(Windows Server 2012)上部署 Angular 2 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 AngularJS 2 框架的新手,但被卡住了!

I'm new in AngularJS 2 framework and I'm stuck!

我想在 Windows Server 2012 上部署一个应用程序(例如快速入门).我已经在上面安装了 Apache tomcat.我做了什么 :我使用命令 npm build(带和不带-prod")来生成 dist 文件夹(输出:index.html & 包文件)然后我把它放到 tomcat 的webapps"文件夹中,然后我尝试使用浏览器访问页面,索引页面显示正在加载..."!我认为角度不起作用...

I want to deploy an application (quickstart for example) on a Windows Server 2012. I have already installed Apache tomcat on it. What I did : I used the command npm build (with and without "-prod") in order to generate the dist folder (output : index.html & the bundle files) then I putted it into 'webapps' folder in tomcat, then I tried to reach the page using my browser, the index page is showing me "Loading..."! I think that angular is not working...

我尝试在服务器上安装 NodeJs 然后生成一个简单的项目 (npm install -g angular-cli) 并在服务器上运行它..它在本地主机(服务器)上工作但在我的机器上使用IP_of_sv:Port" Chrome 给我一个错误ERR_CONNECTION_REFUSED"!

I tried to install NodeJs on the server then generate a simple project (npm install -g angular-cli) and run it on the server.. it works on the localhost (server) but on my machine using "IP_of_sv:Port" Chrome gives me an error "ERR_CONNECTION_REFUSED"!

你能帮我简单解释一下吗?

Can you help me please with simple explanations please?

先谢谢你!

推荐答案

我找到了解决方案:

我必须插入包文件的正确路径!

I had to insert the right path to the bundle files!

例如,我将索引文件的 src 属性从:src="inline.bundle.js"

I changed for example the src attribut of the index file from : src="inline.bundle.js"

到:src="dist/inline.bundle.js"

to : src="dist/inline.bundle.js"

刚刚添加了 DIST FOLDEEEEEER!哈哈感谢您的帮助!

Just added the DIST FOLDEEEEEER ! Haha Thank you run yards for your help !

这篇关于如何在 tomcat 服务器(Windows Server 2012)上部署 Angular 2 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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