8

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

Haifeng Zhang
  • 30,077
  • 19
  • 81
  • 125
National News
  • 81
  • 1
  • 1
  • 2
  • 1
    use universal webpack to bundle your project into one js file with index,html. you can upload that as normal html and js file. if backend is in node.js go for digital ocean or heroku. – Amit kumar Jan 28 '17 at 07:27

5 Answers5

16

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

manojtc
  • 562
  • 3
  • 10
11

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 .

  1. Click on public_html folder .

  2. 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

Anand raj
  • 111
  • 1
  • 4
6

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.

Nishanth Sreedhara
  • 1,266
  • 1
  • 19
  • 34
Geetanshu Gulati
  • 692
  • 8
  • 13
2

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

enter image description here

VS. enter image description here

tborges
  • 117
  • 1
  • 8
0

manojtc is corect...run npm build then copy all the files/folders from the dist directory to your website (or sub-domain) root folder...works like a charm..have it working in a GoDaddy Windows sub-domain

SuperRoo
  • 87
  • 1
  • 7