Tag Archives: python AI BlockChain

Port 4200 is already in use.Use ‘-port’ to specify a different port error Reasons

Port 4200 is already in use. Use ‘-port’ to specify a different port error Reasons
An existing application(not angular) in your system using the port number 4200. This is a very rare scenario. In this case, you need to change the port number of angular application as mentioned below.
You already ran ng serve and to exit the application you typed Control Z (Ctrl+Z), And then you typed ng serve then you will get port 4200 is already in use_ error. In this case, you need to kill the previous process
To close or terminate the angular instance always use Control+C (Ctrl+c)
And ng serve uses default port number 4200 to run the angular application. And our application URL will be http://localhost:4200. To avoid this error we need to change the port number to other port which is free.
According to RFC 793 port numbers is a 16-bit unassigned integer. The minimum value is 0 and the maximum value is 65535.
And, within this range, ports 0 – 1023 are reserved for specific purposes(mostly).
To change the port number for our angular application use the below command
ng serve –port 4201
Now type ng serve
Our angular application will be running on http://localhost:4201
To kill already existing angular process use the below commands
Fix Port 4200 is already in use. Use ‘-port’ to specify a different port error in Mac & Linux
To fix port 4200 is already in use error in In Mac & Linux OS (Ubuntu etc) use the following commands
sudo kill $(sudo lsof -t -i:4200) Or
sudo kill sudo lsof -t -i:4200 Or
sudo lsof -t -i tcp:4200 | xargs kill -9
Fix Port 4200 is already in use. Use ‘-port’ to specify a different port error in Window
In Window operating system open command prompt. Use the following command to fix port 4200 is already in use error.
netstat -a -n -o | findStr “4200”`
Take the process id and kill the process using the following command
taskkill -f /pid 11128

ERROR in AppModule is not an NgModule No NgModule metadata found for ‘AppModule’.

Angularjs2’s environmental problems have been solved for a long time.
Baidu’s answer is also a variety of also can not solve my problems.
Fortunately, these days after constant testing finally to solve.
ERROR in AppModule is not an NgModule
ERROR in ./src/main.ts
Module build failed: TypeError: Always read the property ‘newLine of undefined
at the Object. The getNewLineCharacter (d: \ web \ myNg \ ng2 \ node_modules \ typescript \ lib \ typescript js: 8062:20)
at the Object. The createCompilerHost (d:\web\myNg\ng2\node_modules\typescript\lib\typescript.js:44978:26)
at Object.ngcLoader (d:\web\myNg\ng2\node_modules@ngtools\webpack\src\loader.js:338:33)
@ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts
ERROR in ./src/polyfills.ts
Module build failed: TypeError: Always read the property ‘newLine of undefined
at the Object. The getNewLineCharacter (d: \ web \ myNg \ ng2 \ node_modules \ typescript \ lib \ typescript js: 8062:20)
at the Object. The createCompilerHost (d:\web\myNg\ng2\node_modules\typescript\lib\typescript.js:44978:26)
at Object.ngcLoader (d:\web\myNg\ng2\node_modules@ngtools\webpack\src\loader.js:338:33)
@ multi ./src/polyfills.ts
webpack: Failed to compile.
This error is due to a local Typescript version conflict. But I don’t know why NPM is doing this. The web site says its mechanism is not supposed to cause version conflicts. It hasn’t been studied.
first:
$ npm ls typescript
Enter this command to see the Typescript version and dependencies of your project.
Two different versions have been found in various places.
Angular \ CLi relies on 2.1.6, which is automatically generated, so you can’t go to the node_module to find package.json. Can’t change. To give up.
[email protected] d: \ web \ myNg \ ng2
– – @ presents/[email protected] – & gt; D :\web\myNg\ node_modules.1.0.0-rc-1 @angular\cli
| ± -@angular /[email protected]
| | ± -@angular /[email protected]
| |>0 -- [email protected] deduped extraneous>1>2 [email protected] extraneous
| ± -@angular /[email protected]
| | ± [email protected]
|>0>1 -- [email protected] extraneous>3 [email protected] extraneous
>4 ±- @ngtools/[email protected]
| |-- [email protected] extraneous |[email protected]
‘– [email protected]
Then the other 2.0.10 is configured in the project’s package.json. This is angular/ CLI generated, but it’s in our own project, so it’s easy to change typescript to the angular/ CLI dependent version.
“Typescript” : “~2.0.0”
“change this to
” typescript “:” ~2.1.0 “
~ means that NPM automatically downloads the nearest smaller version. For example, it’s 2.1.6 on my computer. In this case, the Angular/CLI dependencies themselves are completely consistent.
again
$ npm ls typescript
Found that the version is consistent.
[email protected] d: \ web \ myNg \ ng2
– – @ presents/[email protected] – & gt; D :\web\myNg\ node_modules.1.0.0-rc.1@@angular\cli
| -- [email protected][email protected] -> D: \ web \ myNg \ ng2 \ node_modules 2.1.6 @ typescript
$ ng serve
** NG Live Development Server is running on http://localhost:4200 **
Hash: b21dc5aadbb6f2b69213
Time: 10251ms
chunk {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 158 kB {4} [initial] [rendered]
chunk {1} main.bundle.js, Rendered]
chunk {3} vendor.js.map (main) 3.14 kB {3} [initial] [rendered]
chunk {2} styles. funds. js (styles) 9.84 kB {4} [initial] Version2.6 MB [initial] [br> chunk {4} invitation.js, ininvitation.js map (ininvitation.js) 0 bytes [entry] [rendered]
webpack: Compiled.
Get things done. I will make a note here in the hope that I can help others I meet later. After all, it’s such a waste of time.
Also, remember to use CNPM install when installing the environment. The native NPM Install will report an error because Node-Sass is blocked.
The original link: https://blog.csdn.net/yaerfeng/article/details/62610510