I'm new in AngularJS 2 framework and I'm stuck!
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...
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?
Thank you in advance!
Just build it out using any of the build tasks(dev will include some source maps, and don't worry about having node on the server as node is only needed for the development tooling. Then just copy over all the files in the dist folder. Have a look in the index.html and make sure that the references to the various scrips are correct. The only thing the app needs to run is the scrips in the index, no node is needed.
If your are using angular-cli command to create angular 2 project.Then cli has given some commands to deploy your application into production. Use command like ng build --prod on your project directory and it will generate dist folder in your directory.
Go to inside dist folder and change the base href like href="." in index.html. After that copy dist folder in your tomcat root directory and run the server.. you can see below screen shot our application running on tomcat server.
ng build --prod
on your terminal/
from.
in likehref="."
and go to url example: http://localhost:8080/ProjectName/#/URL and check it.You can change one place in the index.html: <base href="/">
Make the base href to be your relative path form webapps folder in tomcat to the folder that includes the index.html of your angular app.
In your case, change it to: <base href="./dist">
No other changes are needed.
Use the link where I posted the solution for that. Please check and let me know if you have any other issues. Deploy Angular 2 App with Webpack to Tomcat - 404 Errors
I've found the solution:
I had to insert the right path to the bundle files!
I changed for example the src attribut of the index file from : src="inline.bundle.js"
to : src="dist/inline.bundle.js"
Just added the DIST FOLDEEEEEER ! Haha Thank you run yards for your help !