Tuesday, 27 September 2022

angular deploy in dev and local

1) https://bobbyhadz.com/blog/npm-command-not-found-ng#:~:text=To%20solve%20the%20error%20%22ng,in%20your%20system's%20environment%20variable.

install angular cli, npm install @angular/cli@latest 

2) npm install or npm install --force

3)check environment directory, ensure u have environments.ts, and environments.prod.ts

sample environments.ts (will be used for npm run build for dev version), environment.prod.ts will be used for ng build --prod , environment.prod.ts will be the same thing just different name)

3) use ng build --configuration production 


If above process failed I.E ng build --prod failed, manually change environments.ts file,  change name to 'prod', production:true, then run npm run build

4) change permission of dist folder to 750, user group based on ur web server

environments.ts


// This file can be replaced during build by using the `fileReplacements` array.

// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.

// The list of file replacements can be found in `angular.json`.


import { NgxLoggerLevel } from 'ngx-logger';


export const environment = {

// use 'PROD' for production

    name: 'LOCAL', 

    production: false,

    apiPath: 'https://test',

    urls: {

        samlSsoUrl: '',

        samlSloUrl: ',

    },


    token: {

        name: 'tkn',

        storage: 'Memory',

    },

    logger: {

        apiUrl: '', // Replace with local API

        logLevel: NgxLoggerLevel.DEBUG,

        serverLogLevel: NgxLoggerLevel.ERROR,

    },

    isOffline: false,

};


No comments:

Post a Comment