Skip to content

Commit

Permalink
fix: webapp - wsl shell source not found
Browse files Browse the repository at this point in the history
A bug was found (see GitHub Issue #153), where when a user attempting to run the `npm run dev` or `npm run fastapi-dev` commands from within a (Windows) WSL Ubunutu Shell window, encounters the following error, which prevents the backend FastAPI server from running:

`sh: 1: source: not found`

Given it appears that `source` is a command built-in and runnable on Bash and ZSH terminal environments, it is not available to use within the WSL Ubuntu shell by default.

To fix this, a more universal substitute can be used in place of `source`, which is the period `.`, which performs the same function in Bash, ZSH, and WSL Ubunutu terminal / shell environments.

This commit also includes minor `webapp/README.md` updates to reformat lists to numbered lists for both the `Setup` and `Debugging` sections for improved clarity.
  • Loading branch information
Sayvai committed Sep 23, 2023
1 parent ebf6983 commit ad9d209
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
30 changes: 15 additions & 15 deletions webapp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ View a brief GIF demo of the web apps' design functionality below:

### Setup

- clone the repository
- navigate to the project directory (e.g. `cd Resume-Matcher`)
- Follow the [README](../README.md) instructions set out in the root of the repository to setup the Python environment and run the Python scripts.
- navigate to the `webapp` directory (e.g. `cd webapp`)
- run `npm install` to install the frontend client app dependencies
- run `npm run dev` to start the web app (i.e. this script will start the frontend client and backend FastAPI servers concurrently within one terminal process inside `webapp` directory`)
- once both servers are ready, open [http://localhost:3000](http://localhost:3000) on your browser to view and interact with the app.
1. clone the repository
2. navigate to the project directory (e.g. `cd Resume-Matcher`)
3. Follow the [README](../README.md) instructions set out in the root of the repository to setup the Python environment and run the Python scripts.
4. navigate to the `webapp` directory (e.g. `cd webapp`)
5. run `npm install` to install the frontend client app dependencies
6. run `npm run dev` to start the web app (i.e. this script will start the frontend client and backend FastAPI servers concurrently within one terminal process inside `webapp` directory`)
7. once both servers are ready, open [http://localhost:3000](http://localhost:3000) on your browser to view and interact with the app.

### Extra Setup Hints

Expand Down Expand Up @@ -63,25 +63,25 @@ When working with the backend web application files, you may like to debug the b

#### Start the Backend Server in Debug Mode

- ⚠️ IMPORTANT: Before proceeding along this set of steps, ensure the frontend server is NOT running. It will need to be running in isolation of the backend server, after the backend server has succesfully completed its starup process.
1. ⚠️ IMPORTANT: Before proceeding along this set of steps, ensure the frontend server is NOT running. It will need to be running in isolation of the backend server, after the backend server has succesfully completed its starup process.

- Open the VS Code debugger tab (i.e. the bug icon on the left sidebar)
2. Open the VS Code debugger tab (i.e. the bug icon on the left sidebar)

- Select the "Debug FastAPI Backend" configuration from the dropdown
3. Select the "Debug FastAPI Backend" configuration from the dropdown

- Click on the play button to start the backend server in debug mode
4. Click on the play button to start the backend server in debug mode

- A new terminal window will open and the backend server will start running in debug mode
5. A new terminal window will open and the backend server will start running in debug mode

- You may optionally set breakpoints in the backend python files to pause execution on certain line(s), inspect variable values, and other runtime data, as you interact with the app or make requests to the backend server.
6. You may optionally set breakpoints in the backend python files to pause execution on certain line(s), inspect variable values, and other runtime data, as you interact with the app or make requests to the backend server.

- Esnure the frontend server is running in isolation of the backend server, after the backend server has succesfully completed its starup process. By running the following command in a separate terminal window:
7. Esnure the frontend server is running in isolation of the backend server, after the backend server has succesfully completed its starup process. By running the following command in a separate terminal window:

```bash
npm run next-dev
```

- Once the backend server (and frontend server) is ready, open [http://localhost:3000](http://localhost:3000) on your browser to view and interact with the app.
8. Once the backend server (and frontend server) is ready, open [http://localhost:3000](http://localhost:3000) on your browser to view and interact with the app.

### Visual demonstration of running the FastAPI backend server in VS Code Debugger

Expand Down
2 changes: 1 addition & 1 deletion webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"next-dev": "next dev",
"fastapi-dev": "source ../env/bin/activate && pip install -r ../requirements.txt && python -m uvicorn backend.api.index:app --reload",
"fastapi-dev": ". ../env/bin/activate && pip install -r ../requirements.txt && python -m uvicorn backend.api.index:app --reload",
"dev": "concurrently \"npm run next-dev\" \"npm run fastapi-dev\"",
"build": "next build",
"start": "next start",
Expand Down

0 comments on commit ad9d209

Please sign in to comment.