Could you please help me to change my port into 4900 by using npm, cause I can't change my port by using " ng s --port 4900 "
Message showing -
PS G:\PROJECTS\PetroHSE> ng s --port 4900
ng : The term 'ng' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:1
- ng s --port 4900
- ~~
- CategoryInfo : ObjectNotFound: (ng:String) [], CommandNotFoundException
- FullyQualifiedErrorId : CommandNotFoundException
and if i use " npm s --port 4900 " showing
PS G:\PROJECTS\PetroHSE> npm s --port 4900 NAME | DESCRIPTION | AUTHOR | DATE | VERSION | KEYWORDS sfs4900 | Transliteration… | =petuomin | 2016-11-02 | 0.0.1 | SFS-4900 sfs4900 standard romanization russian finnish transliteration @alifd/theme-4900 | Powered By… | =mark-ck… | 2019-01-15 | 0.1.1 | PS G:\PROJECTS\PetroHSE> npm start
Please tell me how to change port by using " npm ", Thank You...
CodePudding user response:
it appears that Angular CLI is not installed globally.
Try running npm install -g @angular/cli
this command will install Angular CLI globally.
CodePudding user response:
Probably you do not have angualar cli installed globally. Many people do, but you certainly do not have to (I definitely prefer not to)
You can use 2 ways to accomplish what you want:
- use npx:
npx ng serve --port=4900ornpx ng s --port=4900(sNOT-s) - edit the file
package.jsonIn here you will find a part with scripts. You'll see that by defaultstartscript hasng servein it. Edit this tong serve --port=4900, save and exit. Then just runnpm start. This option is more useful if you always want to start the server locally on this port.
