I have an angular-2 project running on my local host. I want to deploy it to GoDaddy server. I can't install node, npm on GoDaddy server. So my question is how can I run my angular-2 project on GoDaddy server. Thanks
Step 1: Login to your GoDaddy account, click on Hosting, and select Manage Account to go to the control panel. Step 2: Click “Content” and select “FTP Client”. Step 3: Upload your web application folder by selecting the application folder on your Local System and clicking “>>” to upload to the root folder.
2. Go to your project/dist Copy your Build Project which is automatically created and paste it to desktop -> Right Click on that pasted project folder -> Add to zip . 3. Go to your godaddy account -> profile -> my Products ->Starter Linux Hosting with cPanel ->manage ->cpanel Admin -> file manager .
You have to command ng build --prod . This will build your app into the dist folder. Copy the contents of your dist folder to the public directory of your shared hosting. Works great, if Angular 2 CLI was used, otherwise it returns You have to be inside an angular-cli project in order to use the build command. .
You just need a github repository to host on github and make sure that you pushed the latest code. Install github pages tool for angular by using, npm install -g angular-cli-ghpages . Here deploying code in github pages is quite easy, Just need to make sure one thing, when you build your code, use --base-href tag.
Install Angular CLI if you don't have it already.
npm install -g angular-cli
Then build using the command -
ng build
This will create a /dist directory with the production build of your application. Just copy the contents of /dist to your hosting provider (using FTP, SCP etc.).
Refer - https://github.com/angular/angular-cli
1.If your project is completed then build your project using
ng build --prod
2.Go to your project/dist Copy your Build Project which is automatically created and paste it to desktop -> Right Click on that pasted project folder -> Add to zip .
3.Go to your godaddy account -> profile -> my Products ->Starter Linux Hosting with cPanel ->manage ->cpanel Admin -> file manager .
Click on public_html folder .
click on Upload -> select file -> select your Zip folder -> click on link "Go Back to "home/frurugf45/public_html" .
And your Angular file uploaded on go godaddy server
Run ng build --prod
don't forget to use --prod
. It means build the application in Production mode. It's performance of application is faster than ng build.
Use $ ng build --prod
if your application is ready for production. It will reduce the size and increase speed of your application on the web. $ ng build
VS. $ ng build --prod
My small application went from 23mb to 2mb.
Loading time on 3G network: 8 seconds FAIR, 28% visitor loss due to loading time
VS.
Loading time on 3G network: 4 seconds GOOD, 10% visitor loss due to loading time
VS.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With