如何在Tomcat服务器(Windows Server 2012)上部署Angular 2应用程序
我是AngularJS 2框架的新手,我被卡住了!
I'm new in AngularJS 2 framework and I'm stuck!
我想在Windows Server 2012上部署应用程序(例如,quickstart).我已经在上面安装了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...
我尝试在服务器上安装NodeJ,然后生成一个简单项目(npm install -g angular-cli)并在服务器上运行.它在localhost(服务器)上运行,但在我的机器上使用"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 !