Parcel: configured port 1234 could not be used - parceljs

I need to run my ReactJS application on the port 1234 but when I run yarn dev, I get the following:
$ parcel src/index.html --port 1234
Server running at http://localhost:2493 - configured port 1234 could not be used.
√ Built in 11.45s.
It doesn't tell me why it can't run on port 1234, so I suspected that the port might be in use already. According to this answer, the following should tell me what process is using that port.
Get-Process -Id (Get-NetTCPConnection -LocalPort portNumber).OwningProcess
But that didn't help, it gave the following message:
Get-NetTCPConnection : No MSFT_NetTCPConnection objects found with property 'LocalPort' equal to '1234'. Verify the value of the property and retry.
Which I guess means there is no process bound to port 1234. But if that is the case, why can't I bind to that port?
My package.json is as follows:
{
"name": "bejebeje.react",
"version": "1.0.0",
"description": "bejebeje's react-js frontend",
"main": "index.js",
"repository": "git#github.com:JwanKhalaf/Bejebeje.React.git",
"author": "John",
"license": "GPL-3.0",
"dependencies": {
"#fortawesome/fontawesome-svg-core": "^1.2.19",
"#fortawesome/free-brands-svg-icons": "^5.9.0",
"#fortawesome/free-solid-svg-icons": "^5.9.0",
"#fortawesome/pro-light-svg-icons": "^5.9.0",
"#fortawesome/pro-regular-svg-icons": "^5.9.0",
"#fortawesome/pro-solid-svg-icons": "^5.9.0",
"#fortawesome/react-fontawesome": "^0.1.4",
"#reach/router": "^1.2.1",
"oidc-client": "^1.8.2",
"react": ">=16",
"react-dom": "^0.14.9 || ^15.3.0 || ^16.0.0-rc || ^16.0",
"react-icons": "^3.7.0",
"styled-components": "^4.3.2"
},
"scripts": {
"dev": "parcel src/index.html --port 1234",
"build": "parcel build src/index.html"
},
"devDependencies": {
"#fortawesome/fontawesome-pro": "^5.9.0",
"axios": "^0.19.0",
"parcel-bundler": "^1.12.3",
"prettier": "^1.16.4",
"sass": "^1.22.5"
}
}

After creating a little C# web server that would attempt to bind to the port 1234 I still couldn't get it to work. It would try to bind, but would throw an exception saying:
An attempt was made to access a socket in a way forbidden by its access permissions.
Anyways, after much pain and research here is what finally worked:
First, disable hyper-v (this will restart your PC, so ensure all work is saved). In PowerShell (as admin) run the following:
dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
When your PC has restarted, you need to reserve the port you want so hyper-v doesn't reserve it back, again via PowerShell as admin, run the following:
netsh int ipv4 add excludedportrange protocol=tcp startport=50051 numberofports=1
Now finally re-enable hyper-V (PC will restart again), again via PowerShell as admin:
dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All
when your PC has finished and is back up, you should be able to bind to that port successfully.

Testing locally with parcel I was able to get the same error with knowingly forcing the following states:
Port in use
Unauthorized use of port
Invalid port
The error message you get is pretty cruddy. To determine what the actual error is you can try and bind the port using other language or program you wish. Since were in javascript we can use this script
require('http').createServer(function(){}).listen(1234);
In my case I already bound port 1234 in a different application and I receive the following error:
events.js:174
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::1234
at Server.setupListenHandle [as _listen2] (net.js:1270:14)
at listenInCluster (net.js:1318:12)
at Server.listen (net.js:1405:7)
at Object.<anonymous> (C:\workdir\ETL_feed\listen.js:1:106)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
Emitted 'error' event at:
at emitErrorNT (net.js:1297:8)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:757:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
As you can see this error message is much more detailed that parcels error. When binding ports many are taken by existing applications for example Wikipedia reports that port 1234 is used by VLC media player (however it reports UDP only).

I was getting this error on a project, but it turns out that the issue was that my project was running on HTTPS while Parcel.js (v2.0) was bundling over HTTP.
This is my original Parcel.js command:
parcel serve path/to/my.file
And this is the fixed version, which bundles over HTTPS:
parcel serve path/to/my.file --https
I'm sure my solution won't fix every instance of the error, but it's worth considering.

Related

Error: EADDRINUSE connect EADDRINUSE 127.0.0.1:50596 when running e2e test suit on VS code

When I run e2e test suites on VS code getting an unusual error - Error: EADDRINUSE connect EADDRINUSE 127.0.0.1:50596 don't know how to solve this, its happening to all instance and failing all test cases with same error. when I debug this in dev tools getting this error in console log (node:16612) [DEP0005] Deprecation Warning: Buffer() is deprecated due to security and usability issues. Please use the buffer. From() methods instead.
(Use Code --trace-deprecation … to show where the warning was created)
Node version >v11.15.0**
NPM. version >6.7.0
Chrome browser
This error Error: EADDRINUSE connect EADDRINUSE 127.0.0.1:50596 means the address 127.0.0.1:50596 is already used.
You can find out what's using the port 50596, and then kill the process (see https://www.printsupportcenter.com/hc/en-us/articles/115003386949-Determine-which-program-uses-or-blocks-a-port):
Windows:
netstat -ano -p tcp | find "50596"
Linux/Mac:
sudo netstat -ano -p tcp | grep ":50596"
These previous commands will give you the Process IDentifier (PID), which you can then use to kill your process:
Windows:
taskkill /PID <pid_number>
Linux/Mac:
kill <pid_number>

weblogic fail to start: Address already in use error

I have a test application that I created to start learn weblogic with Eclipse .
yesterday the jsp page was working well when I run as / on server , I got the basic page that I created .
but today I have an error message :
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
ERROR: transport error 202: bind failed: Address already in use
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:750]
in the browser I got this :
Error 404--Not Found
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.4.5 404 Not Found
The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.
and an other time I got this on console :
weblogic.application.ModuleException: null
null
at weblogic.servlet.internal.WebAppModule.createModuleException(WebAppModule.java:1824)
at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:270)
at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:682)
at weblogic.application.internal.flow.ScopedModuleDriver.init(ScopedModuleDriver.java:162)
at weblogic.application.internal.ExtensibleModuleWrapper.init(ExtensibleModuleWrapper.java:98)
Truncated. see log file for complete stacktrace
can you explain to me what I miss , when I start the server it has the status started . thank you I can add any information .
The most probable cause is server running in debug mode and having the same debug port as an existing server on same machine.
If you have multiple domains configured for each domain running in development mode on the same machine make sure DEBUG_PORT in the setDomainEnv script has different values.
If you have multiple managed servers on the same domain and same machine, create a separate startManagedWeblogic script to start your managed servers and set the Debug Port in that script.
If you use Node Manager to start your managed servers, make sure you have the following lines set in your nodemanager.properties file, otherwise etDomainEnv.sh won't be executed:
StartScriptEnabled=true
StopScriptEnabled=true
This way, if you start the Managed Server via the Admin Console, setDomainEnv.sh will get called.
Then, you can modify the WebLogic domain script setDomainEnv.sh to set the proper DEBUG_PORT value according to the server name that needs to be started:
Use your favourite editor to change the setDomainEnv.sh file
You should find the following lines already :
if [ "${SERVER_NAME}" = "" ] ; then
SERVER_NAME="AdminServer"
export SERVER_NAME
fi
The same way, you can add :
if [ "${SERVER_NAME}" = "ManagedServer1" ] ; then
DEBUG_PORT="8454"
export DEBUG_PORT
fi
if [ "${SERVER_NAME}" = "ManagedServer2" ] ; then
DEBUG_PORT="8455"
export DEBUG_PORT
fi

How to set proxy in config for protector

I am using protector with angular 4, when i run e2e test it failed to download some dependency from network as it blocked within my org proxy.
I tried to set proxy in protractor.conf.js, but it did not work for me.
capabilities: {
'browserName': 'chrome',
'proxy': {
'proxyType': 'manual',
'httpProxy': 'http://ptx.proxy.corp.sopra:8080'
}
below error I'm getting when run ng e2e
webpack: Compiled successfully.
events.js:183
throw er; // Unhandled 'error' event
^
Error: connect ETIMEDOUT 216.58.204.144:443
at Object._errnoException (util.js:1024:11)
at _exceptionWithHostPort (util.js:1046:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)
Can someone please tell me how to use the proxy within in.
I did find a way around to set the proxy, I set up proxy in system environment variable with key http_proxy and ng e2e ran fine for me.

wsadmin adminApp.update java.net.UnknownHostException Full-Qualified-Hostname

Try to deploy an EAR file to WebSphere enterprise app, over a SOAP connection.
the command line:
call wsadmin -conntype SOAP -host %WAS_HOST% -port %WAS_PORT% -user %WAS_USER% -password !WAS_PASSWORD! -lang jython -c "AdminApp.update('%APP_NAME%', 'app', '[ -operation update -contents %EAR_FILE% -usedefaultbindings -defaultbinding.virtual.host default_host -nopreCompileJSPs -installed.ear.destination $(APP_INSTALL_ROOT)/%WAS_HOST%Network -distributeApp -nouseMetaDataFromBinary -nodeployejb -createMBeansForResources -noreloadEnabled -deployws -validateinstall warn -noprocessEmbeddedConfig -filepermission .*\.dll=755#.*\.so=755#.*\.a=755#.*\.sl=755 -noallowDispatchRemoteInclude -noallowServiceRemoteInclude -asyncRequestDispatchType DISABLED -nouseAutoLink -MapModulesToServers [[ %MODULE_NAME% %WAR_FILE%,WEB-INF/web.xml WebSphere:cell=%WAS_HOST%Network,cluster=%CLUSTER%+WebSphere:cell=%WAS_HOST%Network,node=%WEB_NODE%,server=%WEB_NODE% ]]]' )"
is issued from a build machine that is on windows. where WAS_HOST=MySrvrA.mycomp.com
when running this command, I got
WASX7209I: Connected to process "dmgr" on node eagnmncom0cbbManager using SOAP connector; The type of process is: DeploymentManager
WASX7015E: Exception running command: "AdminApp.update ...
....
exception information:
com.ibm.websphere.management.filetransfer.client.TransferFailedException
java.net.UnknownHostException: java.net.UnknownHostException: MySrvrA
the WebSphere App server is on Linux, and the /etc/hosts file has the contents:
IP-Address Full-Qualified-Hostname Short-Hostname
#
127.0.0.1 localhost
special IPv6 addresses ::1 localhost ipv6-localhost ipv6-loopback
fe00::0 ipv6-localnet
ff00::0 ipv6-mcastprefix ff02::1 ipv6-allnodes ff02::2 ipv6-allrouters
ff02::3 ipv6-allhosts
56.xxx.xxx.xxx MySrvrA.mycomp.com MySrvrA
this server can be accessible over the internet via the Full-Qualified-Hostname only.
To trouble shoot, I have
1) run a command of
call wsadmin -conntype SOAP -host %WAS_HOST% -port %WAS_PORT% -user %WAS_USER% -password !WAS_PASSWORD! -lang jython -c "print Help.help()"
this works, and it should prove that the connection from the build machine to the WAS server is good.
2) to further prove that the AdminApp.update and its resolved parameters works, I have run the AppAdmin.update in its entirety:
AdminApp.update('%APP_NAME%', 'app', '[ -operation update -contents %EAR_FILE% -usedefaultbindings -defaultbinding.virtual.host default_host -nopreCompileJSPs -installed.ear.destination $(APP_INSTALL_ROOT)/%WAS_HOST%Network -distributeApp -nouseMetaDataFromBinary -nodeployejb -createMBeansForResources -noreloadEnabled -deployws -validateinstall warn -noprocessEmbeddedConfig -filepermission .*\.dll=755#.*\.so=755#.*\.a=755#.*\.sl=755 -noallowDispatchRemoteInclude -noallowServiceRemoteInclude -asyncRequestDispatchType DISABLED -nouseAutoLink -MapModulesToServers [[ %MODULE_NAME% %WAR_FILE%,WEB-INF/web.xml WebSphere:cell=%WAS_HOST%Network,cluster=%CLUSTER%+WebSphere:cell=%WAS_HOST%Network,node=%WEB_NODE%,server=%WEB_NODE% ]]]' )
directly on the WAS server. it works, and should prove the AdminApp.update and it's options and parameters are good.
it seems to me that over a SOAP deployment, AdminApp.update truncated the WAS_HOST and does not use the Full-Qualified-Hostname.
What I am doing wrong, and how can I resolve this?
I have another machine set that are accessible from the Internet via the Short-Hostname, the same command line works perfectly over SOAP connector.
It turns out that a security restriction causes the issue.
The target WAS server is in DMZ .com, while the build machine is in the blue .xxx, file transfer from .xxx to .com is not allowed based on the security policies of the organization.
After adding the target WAS servers into the C:\Windows\System32\Drivers\etc\hosts of the build machine, the deployment goes successfully.

JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:690]

I have been trying to run with JRebel this configuration:
Here is my output:
c:\JBOSS\jboss-portal-2.7.2\bin\run.bat -c default
c:\JBOSS\jboss-portal-2.7.2\bin>set JAVA_OPTS=-Dhttp.proxyHost=188.173.32.78 -Dhttp.proxyPort=3128 -DproxySet=true
===============================================================================
JBoss Bootstrap Environment
JBOSS_HOME: c:\JBOSS\jboss-portal-2.7.2
JAVA: C:\Program Files\Java\jdk1.6.0_25\bin\java
JAVA_OPTS: -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n -Dhttp.proxyHost=188.173.32.78 -Dhttp.proxyPort=3128 -DproxySet=true -Dprogram.name=run.bat -server -Xms256m -Xmx512m -XX:MaxPermSize=256m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
CLASSPATH: C:\Program Files\Java\jdk1.6.0_25\lib\tools.jar;c:\JBOSS\jboss-portal-2.7.2\bin\run.jar
===============================================================================
[2012-07-16 12:32:53,968] Artifact app-ear:ear: Artifact is being deployed, please wait...
[2012-07-16 12:32:53,972] Artifact my-portlet:war: Artifact is being deployed, please wait...
Connected to server
[2012-07-16 12:32:54,007] Artifact app-ear:ear: Artifact is deployed successfully
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
ERROR: transport error 202: bind failed: Address already in use
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:690]
Disconnected from server
Notice the following start up parameter in your post.
-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n
There must be some other process occupied the 8787 port.
The 8787 port is already in use.
If the 8787 port in use by another application, you need to select a different port number in file run.bat
For example, 18787
Usually this error occurs when the port is already in use. Based on my experience, this usually happen when the server didn't started successfully making the server still running in the process. If you're using windows, you can check out your Task Manager (Ctrl+Shift+Esc) and then look for "java.exe" process. Terminate it and try to start your server again.
ERROR: transport error 202: bind failed: Address already in use
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
from "JAVA_OPTS: address=8787"
You set Address 8787
Find the PID
netstat -ap | grep 8787
If you still see the PID with the above command, then
there are child PIDs. To find the child PIDs
pstree -p
and
pstree -p | grep previousPID
Find the groupPID of the PID
ps x -o "%r %p %y %x %c"
Kill the found PID
kill -TERM -groupPID
This problem occurs whenever the port required to run your server is already in use by some other application. Since the port number 8080 which i used for my jetty server was already in use,it gave me this error so I just changed the port from 8080 to 7070 and it worked for me..
Check the debug port in your
standalone.sh
It must have been
DEBUG_MODE=true
DEBUG_PORT="8787"
Change the debug mode to false or pass a new debug port from the new sh file which calls this standalone --debug 8788
In my case, this argument was wrong: address=server4.example.com:8787 I was trying to run from another server, e.g., server3.example.com.