angular-cli


How to change angular 2 port from 4200 to any other


I want to use 5000 instead of 4200 ..
what i have tried is i have created a file on root name "
.ember-cli
" and put JSON
{
"port": 5000
}
But my app still run on 4200 instead of 5000
You can edit default port number that is configured in serve.js file.
Path will be project_direcory/node_modules/angular-cli/commands/serve.js.
Search for this line -> var defaultPort = process.env.PORT || 4200;
Replace with this line -> var defaultPort = process.env.PORT || 5000;
For Permanent:
Goto nodel_modules/angular-cli/commands/server.js
Search for var defaultPort = process.env.PORT || 4200; and change 4200 to anything else you want.
To Run Now:
ng serve --port 4500 (You an change 4500 to any number you want to use as your port)
Changing nodel_modules/angular-cli/commands/server.js is a bad as it will be updated when you install new version of angular-cli. Instead you should specify ng serve --port 5000 in package.json like this:
"scripts": {
"start": "ng serve --port 5000"
}
You can also specify host with --host 127.0.0.1

Related Links

Importing Global SCSS into Component SCSS with Angular-CLI
Error during AOT build with angular-cli 24 and Angular 2.4.1
Add importer to node-sass in angular-cli project
angular-cli#1.0.0-beta.23 (2016-12-15) NOT on npm
Angular cli for existing github project
How to pass config data to NgModule so NgModule will be compiled with AOT
Cloning a repo based on Angular CLI
How can I speed up Angular CLI Live Reload - 1-2 minutes per change
Generating a barrel when calling ng g component <myName>
Setting up tether-drop to work with angular-cli#1.0.0-beta.24
Angular CLI (AOT) gives error: ERROR in Cannot determine the module for class
Angular CLI - ng serve won't run unless I specify port
ERROR in Multistyles…Module not Found (Angular-cli.json)
Angular Cli support for inline templates and css
Angular Cli - How do I rebuild my project
How to change angular 2 port from 4200 to any other

Categories

HOME
sharepoint
sql-server-2008
spring
dotnetrdf
xamarin.android
winapi
translation
smartphone
wms
tizen-wearable-sdk
user
websphere-liberty
shader
google-plus
packer
powershell-v3.0
android-source
local
cloudflare
mod-pagespeed
uisplitviewcontroller
opera-mini
grub2
koa
apple-tv
remove-method
spring-test
delete-file
kong
emv
bus-error
upnp
owl-api
reply
roundcube
nunit-3.0
oscommerce
xen
nlb
discord.net
parse-android-sdk
initializer
concrete5-5.7
deepstream.io
alchemy.js
linq-to-entities
soundjs
nashorn
bing-translator-api
pdftk
resuming-training
nstouchbar
bnd
udev
struts-layout
text-classification
crash-reports
festival
shinyjs
vici
svn-merge
build-process
sql-import-wizard
master
tomcat5
mongoskin
cmocka
spservices
abas
team-build
harp
httpie
word-2013
ejabberd-saas
named-ranges
qtestlib
grunt-contrib-concat
x-ua-compatible
genetic-programming
io.js
lumx
slick-2.0
healthvault
iconv
awesomeprint
usn
javascriptserializer
getusermedia
legacy-code
jquery-selectbox
cross-domain-policy
ou
galaxy-tab
paintcomponent
ihttphandler
pantheios
hadoop-plugins
clients
webrat
lazy-c++
hmacsha1
method-signature
document-library

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App