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

angular-cli: ng serve command with config error
Augury Angular-cli When I installed the augury .Error is as follows
Teamcity for building Angular cli app
angular cli update issue on local folder
Access to -aot parameter in code
Missing peer dependencies after installing latest angular-cli: What to do?
angular-cli ng serve : Error: No errors
Getting error after Angular cli update
Does angular-cli uses rollup to do ahead-of-time compilation and adding all into one file?
Angular CLI install error
Using glob for assets in angular-cli throws error
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

Categories

HOME
app-inventor
admin-on-rest
scipy
agile
hana
windows-store-apps
concourse
gspread
websphere-liberty
flexbox
keystore
wordpress-theming
pdo
eclipse-luna
ejs
opera-mini
python-unicode
arraylist
cython
koa
statusbar
uiautomator
multiplayer
rworldmap
bootstrap-typeahead
scalajs-react
java-ee-7
image-quality
helper
multichoiceitems
entity-system
swiftcharts
mmdrawercontroller
npm-publish
forecasting
control-flow-graph
bing-translator-api
cppunit
ivona
rapidweaver
goquery
azureportal
persistent
react-native-fbsdk
execl
c64
backstop.js
tomee
c#-interactive
jackson-databind
squirrel
mongo-c-driver
asp.net-mvc-partialview
persistence.xml
vips
sourcegear-vault
js-cookie
windowlistener
wif
connection-reset
coypu
cpu-cores
gulp-livereload
ctrlp
java-melody
fragment-tab-host
ogr2ogr
ember-addon
ssms-addin
anjuta
uipickerviewcontroller
winrt-httpclient
hamsterdb
visual-studio-addins
sanitization
wic
opendata
windows-mobile-6
javascriptmvc
ruboto
pep8
qtgui
qt4.6
osi
hashalgorithm
fileutils
selectmanycheckbox
electronic-signature
nemerle
testunit
gears

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