No internet access for npm when using cellular hotspot - windows

On Windows 10 npm suddenly can't get internet access in any terminal (Powershell, cmd, wsl, or the terminal in VS Code) when I'm connected to the internet via a mobile phone's hotspot. This was working for years and I don't see what the catalyst was to break it (I hadn't installed anything new or changed any internet settings). If I go to any browser, the internet works fine, it's just from the terminal that it doesn't work. I've tried totally deactivating the firewall and that doesn't fix it. I did run a wsl --shutdown command a few days before noticing this, but I don't see how that would have such a sweeping impact even outside of wsl. All terminals also connect to the internet normally when over wifi that isn't from a cellphone hotspot. After the problem started, I updated Windows to the latest version of Windows 10 but that didn't do anything. The cellphone I'm using is a Pixel4A.
Update: I can still pip install packages but I can't use npm for anything that requires the internet. For example, running npm outdated returned this:
...
22 verbose Windows_NT 10.0.19042
23 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "outdated"
24 verbose node v12.18.4
25 verbose npm v6.14.6
26 error code ECONNRESET
27 error errno ECONNRESET
28 error network request to http://registry.npmjs.org/express failed, reason: read ECONNRESET
29 error network This is a problem related to network connectivity.
29 error network In most cases you are behind a proxy or have bad network settings.
29 error network
29 error network If you are behind a proxy, please make sure that the
29 error network 'proxy' config is set properly. See: 'npm help config'
I don't think I'm behind a proxy but I do get this error when I run an app I'm building locally in the browser (the app still builds):
Proxy error: Could not proxy request /favicon.ico from localhost:3000 to http://localhost/.
This is what nslookup returns in cmd and powershell:
PS C:\> nslookup google.com
Server: UnKnown
Address: 192.168.13.64
Non-authoritative answer:
Name: google.com
Addresses: 2607:f8b0:4006:80a::200e
142.250.80.14

It may be possible your carrier started enforcing a 'no tethering' rule that they likely have in their ToS.
It's really hard to say much more without looking into your network settings but judging by the fact your browser traffic is still fine I'd suspect some sort of proxy does indeed get injected into your pipeline: it can either be somehow pushed onto your windows host or be transparently handling all http traffic on the network.
I think one way to test whether this theory is true or not would be to stand up a VPN client on your phone and route all tethered traffic there.

You could attempt editing the hosts file to manually assign DNS entries and use Bluetooth tethering.

You can try first with a cache clean
$ npm cache clean --force
I know it is not related, but in your situation is harmless,
if this not work.
Then, maybe you could use a mirror
$ npm config set registry https://registry.npm.taobao.org/
and use npm install
$ npm install your-lib-name
you can reset this later with npm set registry
$ npm set registry https://registry.npmjs.org/

First of all, check a list of latest Windows updtating, any installed kb at this period? NO? try to load your OS in safe mode with Network supporting, is it solve problem and works in safe mode? NO? Check result of [ipconfig /all , route print, tracert google.com] by using mobile Accsess Point, and [ipconfig /all , route print, tracert google.com] by using Wi-fi Compare the results.
Final and most hard, but 100% way.. load and install WireShark, set filter to sniff http, https and start internet connection in your shell, in what step it stucks?

If you have Dynatrace installed, this program could be corrupting the normal npm working. After you uninstall Dynatrace, the problem might solve.
Also, doing a full scan for rootkits, spywares, virus, etc with different Antivirus, Anti-malware software's and cleaning what was found could help solve the issue.

Related

create react app On Your Network with WSL2 not working

I am trying to use a mobile device to view the app served by create react app. When I open the IP:PORT recommended by CRA's "On Your Network", the page never loads on my mobile device.
I am working on Windows 10 laptop, using WSL2 with Ubuntu. My network is all wifi, no ethernet cables. My code is on the Ubuntu file system and I run npm start from the same location in a WSL terminal from VS Code with the WSL extension.
I am able to see the app using http://localhost:3000 with browsers on my Windows machine (Chrome, Edge).
I noticed cmd.exe ipconfig lists the IP address that corresponds to "On Your Network" as "Ethernet adapter vEthernet (WSL)". This IP address (172.17.144.244) is different than what ipconfig shows as "Wireless LAN adapter Wi-Fi" (192.168.1.23). I also tried 192.168.1.23:3000 on my mobile device, but it didn't work either.
Some other posts on SO recommend removing a firewall setting that blocks NodeJS applications. I scrolled through the many applications listed in the firewall settings and found nothing for NodeJS apps.
Since WSL2 uses a virtual NIC what you need is enable port forwarding in the Firewall otherwise your server in WSL2 won't be seen by external PCs in your network.
I recommend reading the entire thread but in resume you can start using this script:
https://github.com/microsoft/WSL/issues/4150#issuecomment-504209723
I had the same issue. So instead of trying to restart the Windows, try to open the Powershell terminal, shut down the WSL, and then start it again. it solves to me.
Command to shut down: wsl --shutdown
Command to start: to start: wsl
Source: https://github.com/microsoft/WSL/issues/4885#issuecomment-803881561
I found a tool that fixes this problem: https://github.com/icflorescu/expose-wsl
First you need to run the command in the wsl terminal
npx expose-wsl#latest
and it gives you an ip address of your pc 192.168.0.130 for example, with that ip you can access the project from devices on the same network.
When running npm start:
.
.
.
On Your Network: http://172.48.228.88:3000
enter on mobile device:
http://192.168.0.130:3000
and works.
Note: You have to allow the port through the Windows firewall. In my case the firewall should allow access to 'C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_1.0.3.0_x64__...\wslhost.exe'
You can run your app in Docker instead and use Docker for Windows, enabled for WSL2. It somehow manages dynamic dynamically forward the ports, without having you to change anything in Windows.
I was also having the problem with hot reloading in WSL2 . I tried almost every solution present on github , stackoverflow and where not , from CHOKIDAR_USEPOLLING=true to setting FAST_REFRESH= false in .env file to changing network setting using netsh.... but none of them worked for me and after 2 days of searching solutions and trying to fix it .. finally reverted to wsl 1.
Just run this command on Powershell for now.
wsl --set-version Ubuntu-20.04 1
Consider Nginx for Windows.
I prefer this solution because I'm more familiar configuring web servers and reverse proxies than Windows networking and Powershell.
After unzipping the distribution, for example at C:\somepath\nginx-1.22.1, I add the following reverse proxy configuration to C:\somepath\nginx-1.22.1\conf\nginx.conf
...
http {
...
server {
listen 11500;
server_name wsl2_server;
charset utf-8;
location / {
proxy_pass http://localhost:11500/;
}
}
...
As you can see, I have a web server running on port 11500 in WSL2. When my mobile device requests "lan_ip_of_laptop:11500/", it then forwards to localhost:11500 and WSL2 server completes the request.

Connection terminated during handshake flutter

It's really frustrating, wasted 3 days to get rid of but still on stuck problem showing on macos catalina version 10.15.1 and windows 7 also. My two PC's showing same error. First when i tried to 'get packages'
it's showing this '/Users/mamun/Developer/flutter/bin/flutter --no-color packages get
Waiting for another flutter command to release the startup lock...'
after few moments it's showing..
'/Users/mamun/Developer/flutter/bin/flutter --no-color packages get
Running "flutter pub get" in flutterx...
Connection terminated during handshake
pub get failed (server unavailable) -- attempting retry 1 in 1 second...
Connection terminated during handshake
pub get failed (server unavailable) -- attempting retry 2 in 2 seconds...,
tried this Waiting for another flutter command to release the startup lock
& https://github.com/dart-lang/pub/issues/1729 also.
This is a country-specific problem. In some countries, you got this error like Bangladesh and some African countries. I got a solution to this problem, that is use VPN software when you want to get Packages. VPN software uses other country's IP addresses where this google service works perfectly, So you can easily download packages.
Fixed the issue, my Local Isp blocked pub.dartlang.org that's why it happens.
Use vpn.
If you are not using not prepackaged packages:
stop the process with "ctrl + c"
and try it on project location:
flutter pub get --offline
Use VPN. Or download package from github.
dependencies:
flutter:
sdk: flutter
carousel_pro:
git:
url: https://github.com/jlouage/flutter-carousel-pro.git
ref: master
detailed answer is here:
I was using Hotspot VPN when I faced this issue. Disabling the hotspot worked for me. You can check by disabling any HotSpot or VPN.
Download the stable version instead of the clone via git:
C:\src>git clone https://github.com/flutter/flutter.git -b stable)

Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code

I am trying to run a Jmeter test on remote machine ( macOS sierraO).
I configured jp#gc - Chrome Driver Config and I can connect to the slave machine. However, whenever I try to run it I get
Starting ChromeDriver 73.0.3683.20 (XXXXXXX) on port XXXX
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Mar 08, 2019 12:12:35 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Using local port: XXXXXX
2019-03-08 13:04:39.171 java[10402:23852395] IMKInputSession [0x7f8bcbaaf740 presentFunctionRowItemTextInputViewWithEndpoint:completionHandler:] : [self textInputContext]=0x7f8bcbb578f0 *NO* NSRemoteViewController to client, NSError=Error Domain=NSCocoaErrorDomain Code=4099 "The connection from pid 0 was invalidated from this process." UserInfo={NSDebugDescription=The connection from pid 0 was invalidated from this process.}, com.apple.inputmethod.EmojiFunctionRowItem
I know this is related to the security consideration, but I couldn't find a way to solve for my use case.
My use case is:
I am running jmeter test using:
Run remote server directly from Jmeter 5.1
Run using java-maven-plugin project.
Any thoughts how to configure chromeDriver to run on remote server would be appreciated.
lease protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Solution:
Get your Chrome Browser version and download the ChromeDriver for specific to that version.
Open your Chrome browser > Click on 3 vertical dots (top right corner) > Help > About Google Chrome
Verify the Chrome Version (such as 73 or 74 or other ..)
goto Selenium browser driver download portal and download the Chrome Driver of that version
https://sites.google.com/a/chromium.org/chromedriver/downloads
I could not pass any parameters to chromedriver from p#gc - Chrome Driver Config directly, my config looks like:
where my chromedriver.dir was chromedirver.dir=vu.chromedriver.dir=/path/to/chromedriver
However, I was able to work around it by adding:
workaround.sh for macOS
#!/usr/bin/env bash
/path/to/chromedriver --whitelist-ip $*
workaround.bat for Windows
\\src\\path\\to\\chromedriver.exe --whitelist-ip %*
And that solved my issue for making chromedriver to accept remote connections.
I had the same issue. I fixed by changing to Chromedriver version 80.0.3987.106

Perforce installation in network folder for Windows

I would like to install the Windows version of Perforce in a network location so that users can call p4 via:
\\somewhere\p4.exe -p server:1666 -c some_client_name sync
where "somewhere" is consistently mapped on all Windows machines. I tried to do this by installing locally, then copying p4.exe to \\somewhere.
On the computer where I installed locally, \\somewhere\p4.exe works just fine. But when I switch to another machine and try to run
\\somewhere\p4.exe -p server:1666 info
I get the following error:
Perforce client error
Connect to server failed; check $P4PORT.
TCP connect to server:1666 failed.
A non-recoverable error occurred during a database lookup.
What does this error mean? I couldn't find any information in the documentation; I suspect I might need another file besides p4.exe. Indeed, when I install Perforce locally on the other machine, using the local p4.exe works, but \\somewhere\p4.exe still does not.
Any pointers?
Thanks!
You shouldn't need any other files besides P4.exe.
The TCP connection error is probably because that other machine isn't able to translate "server" into an IP address.
Try using some of the Windows command line tools to diagnose this, as in:
nslookup server
or
ping server
Also, try changing your test to run:
\\somewhere\p4.exe -p NNN.NNN.NNN.NNN:1666 info
where the "NNN.NNN.NNN.NNN" is the IP address of your server machine.

Port localhost:3000 does not respond

I use Windows and I ran the .msi.
localhost:3000 does not respond. I activated and rested iis and cannot see anything under 3000. How can I check if the port is active and if anybody s listening? I tried lsof -i in cmd and I get the error "lsof unrecognized batch file"
Also, when I run meteor from the directory with the example or dummy, I do not have anything else following like
..running, port localhost:3000 active
It doesn't look like the command 'meteor' does anything on my machine.
Do I need to put my meteor folder inside the installation one (i.e. C:/Program Files(x86)/meteor)
Since this question was posted, Meteor has gotten an official Windows installer. See if it works now.

Resources