browser does not launch on running react project on wsl (zsh) - reactjs

I am working on a simple react project on Windows 10 Pro. On trying to run the project with wsl with zsh (npm start) everything works, I get warnings and compilation is done without any errors. The issue I am facing is automatic launch of browser from wsl is not happening.
If I manually open localhost:3000 on my chrome after this command everything works but I would like the wsl terminal to launch my browser on npm start automatically just like it does in most of my other terminals and powershell on windows.
What I have tried:
added a export browser property to my .zshrc with path to chrome from here
Added a bsconfig file to root with following code to set open = true as per from here
I have added the ports from 3000-3999 to my firewall so that wsl can access my host (localhost ip). this fixed previous issue where localhost:3000 would show connection refused error.
I would be happy to provide any more details.
I am very new to wsl and zsh and I would really appreciate any help. Thanks

Related

VSCode Create Dev Container - docker not found (worked before)

I seem to be unable to create any new dev containers on WSL2 Ubuntu (worked fine before) and I don't know how to debug this.
Environment
Windows 11
WSL2 with Ubuntu distribution
VSCode 1.75.1
Extension: Dev Containers 0.275.1 or 0.279.0 (no difference observed)
Extension: WSL 0.75.3
Docker on Windows: none
Docker on WSL Ubuntu: 20.10.22
Scenario
Open WSL2 Ubuntu terminal
Go to desired development folder
Start
code .
VSCode shows on Windows (Mentioning remote host "WSL:Ubuntu")
Command: Dev Containers: Create dev container (e.g. Python container)
Error shows:
Docker returned an error. Make sure the Docker daemon is running and select an option how to proceed.
Log shows:
Start: Run: docker version --format {{.Server.APIVersion}} [883 ms] findLocalWindowsExecutable: Exectuable 'docker' not found on PATH 'C:\Windows\system32;(...)'. [885 ms] Exectuable 'docker' not found on PATH 'C:\Windows\system32;(...)'. [890 ms] Docker returned an error code ENOENT, message: Exectuable 'docker' not found on PATH 'C:\Windows\system32;(...)'.
Already tried
Previous creation of such dev containers on this environment worked fine.
Executing the old dev containers on the current environment still works fine.
Question
I don't know where to get started to debug this. Probably something changed in my environment causing the creation of dev containers to fail, but I have no clue. I can't really reconstruct what would have changed to the setup.
I didn't expect devcontainers to go and look for docker on my Windows path... I read about docker cli being used under the hood, but I never had docker on this Windows system, so it mustn't be essential in the WSL2 setup since it worked before.
Thanks,
Johan

VSCode SSH connection can't see the program but remote terminal can

I work on an HPC cluster. I added my cluster .bashrc ml load git.2.foobar. When I connect to the host on VSCode, it tells me to update my git1.8.
But when I open a terminal on Vscode, git --version returns the one on bashrc.
What is going on?
Thanks!
I also tried adding the ml command to .bash_profile, which didn't fix the issue. I also closed and reopended the host connection to re-source it.

Setup Cypress on WSL ubuntu for windows 10

I am trying to setup Cypress on WSL ubuntu for windows 10 machine. WSL ubuntu does not come up with its own display. Hence, we need to follow few steps before setting up Cypress. I followed all the steps mentioned in the blog here:
https://nickymeuleman.netlify.app/blog/gui-on-wsl2-cypress
But I keep getting the following error:
Cypress failed to start.
This is usually caused by a missing library or dependency.
The error below should indicate which dependency is missing.
https://on.cypress.io/required-dependencies
If you are using Docker, we provide containers with all required dependencies installed.
----------
(Cypress:1690): Gtk-WARNING **: 10:15:51.766: cannot open display: 183.87.117.18:0.0
----------
Platform: linux (Ubuntu Linux - 18.04)
Cypress Version: 4.6.0
I have also installed XLaunch for windows 10.
Was anyone able to resolve this issue earlier ? Could anyone please help me resolve this ?
Thanks
Got the idea from here: https://github.com/microsoft/WSL/issues/4106#:~:text=you%20may%20also%20need%20to%20launch%20vcxsrv%20with%20the%20-ac%20argument.
If you have XLaunch running - exit it by double-clicking on the icon in the taskbar and click Exit;
Then open your start menu > right-click XLaunch shortcut > More > Open file location;
Right-click XLaunch shortcut in the Explorer window > Properties;
Add " -ac" without double quotes right after the closing double quote in the Target field - i.e. for me it was "C:\Program Files\VcXsrv\xlaunch.exe" -ac;
Click ok
Now run Cypress again. Yay! Ran for me :)
For me, this was caused by having a WSL1 image (despite having WSL2 installed). You can check via wsl --list --verbose. Follow steps here to convert to WSL2.

Ionic emulate ios - Error

I'm getting this following error after I ran my app on my own ios device.
No target specified for emulator. Deploying to iPhone-6 simulator
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state
ENOENT, no such file or directory '/Users/cauealmeida/Library/Logs/CoreSimulator/5C6DA43E-3993-4260-87EE-73FEB27DE181/system.log'
Error code 1 for command: ios-sim with args: launch,/Users/cauealmeida/Documents/jobs/dev/ionic-maptest/map-test/platforms/ios/build/emulator/map-test.app,--devicetypeid,com.apple.CoreSimulator.SimDeviceType.iPhone-6,--stderr,/Users/cauealmeida/Documents/jobs/dev/ionic-maptest/map-test/platforms/ios/cordova/console.log,--stdout,/Users/cauealmeida/Documents/jobs/dev/ionic-maptest/map-test/platforms/ios/cordova/console.log,--exit
Error: /Users/cauealmeida/Documents/jobs/dev/ionic-maptest/map-test/platforms/ios/cordova/run: Command failed with exit code 2
I've tried with ionic emulate ios -cls from different projects and the same error is shown.
What am I missing?
Here are the steps you can use to correct this issue:
1) Empty the 'platforms' folder in your Ionic project
2) Re-run ionic platform add ios, ionic build ios, and ionic emulate ios without sudo
3) Still getting a permissions error, make sure all the files in your user's home folder actually belong to that user by running
sudo chown -R username /Users/username
We fixed this using the SO answer here, which was just to Reset Content and Settings in the Simulator menu.
You need to download ios simulator.
Go to xcode and download ios 9 or other simulator.
you also need to install ios-sim using your terminal.
sudo npm install -g ios-sim
also check and confirmed your device is connected properly.
connected device you see in xcode window

Can't connect to localhost:8080 when trying to run Google App Engine program

I'm trying to run the Google App Engine Python 2.7 Hello World program and view it in a browser via Google App Engine Launcher. I followed the install and program instructions to the letter. I copied and pasted the code in the instructions to the helloworld.py file and app.yam1 and verified that they are correct and in the directory listed as the application directory. I hit run on the launcher and it runs with no errors, although I get no sign that is has completed (orange clock symbol next to app name). I get the following from the logs:
Running dev_appserver with the following flags: --skip_sdk_update_check=yes --port=8080 --admin_port=8000 Python command: /opt/local/bin/python2.7
When I try to open in the browser via the GAE Launcher, the 'browse' icon is grayed out and the browser won't open. I tried opening localhost:8080 in Firefox and Chrome as the tutorial suggests, but I get unable to connect errors from both.
How can I view Hello World in a browser? Is there some configuration I need to make on my machine?
I had the same problem. This seemed to fix it:
cd to google_appengine, run
python dev_appserver.py --port=8080 --host=127.0.0.1 /path/to/application
at this point there is a prompt to allow updates on running, I said Yes.
At this point the app was running as it should, also when I quit this and went in using the launcher again, that worked too.
I have to manually start python and make it point to my app folder, for instance in a command line window on Windows I am using python. I installed python in C:\Python27 and my sample app is in c:\GoogleApps\guestbook
C:\Python27>dev_appserver.py c:\GoogleApps\guestbook
and then I can start my app in the Google App Engine Launcher and hit localhost 8080
How about specifying --host argument? You can find it at the bottom of following doc.
https://developers.google.com/appengine/docs/python/tools/devserver
This might be a little late. But still someone might find it useful.
When ever you go and try changing the port number from 8080 to something else, it will not get updated. So the best option is:
Go to your user directory: eg: C:\Username
There will be a Google folder. Go inside
Open the file google_appengine_projects.ini
Change your port number from 8080 to whatever you like 8081
Save it and close the file.
Launch the GAE Launcher again and you will find the changes reflected and the app runs without issues.
7: Access the application using: http://localhost:NewPort/
This can be used to change ports both run port and admin port for your individual projects running locally.
Hope this helps!
The 8080 portion of your url is a port number. Firefox disables visiting url's of other ports by default. You have to enable them by doing the following: http://blog.christoffer.me/post/2012-02-20-how-to-remove-firefoxs-this-address-is-restricted/
Paraphrasing that website:
Open firefox and visit about:conf
In the Filter box, type in network.security.ports.banned.override
If you can't find such a preference, right click to open up the pop-up menu and pick New and then String
As preference name type network.security.ports.banned.override and 8080 as the value.
Done!
It's likely if this continues to not work that your browser is behaving properly (8080 is a fairly standard port). That means that its a problem with the server and we'd have to do some more debugging.

Resources