File size: 2,382 Bytes
100a6dd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Setting Up the Chess UI in WSL

This guide provides instructions for setting up and running the Chess UI in a Windows Subsystem for Linux (WSL) environment.

## Prerequisites

1. WSL installed with a Linux distribution (Ubuntu recommended)
2. Node.js and npm installed in your WSL environment

## Installation Steps

### 1. Install Node.js and npm (if not already installed)

```bash

# Update package lists

sudo apt update



# Install Node.js and npm

sudo apt install nodejs npm



# Check installation

node --version

npm --version

```

Alternatively, use nvm for better Node.js version management:

```bash

# Install nvm

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash



# Reload shell configuration

source ~/.bashrc



# Install latest LTS version of Node.js

nvm install --lts



# Use the installed version

nvm use --lts

```

### 2. Set Up the Project

Navigate to the project directory and run the setup script:

```bash

cd frontend/web

chmod +x setup.sh

./setup.sh

```

### 3. Copy Assets

Run the asset copy script to copy chess pieces and board images to the public directory:

```bash

chmod +x copy-assets.sh

./copy-assets.sh

```

### 4. Fix TypeScript Issues (if needed)

If you encounter TypeScript errors related to React:

```bash

chmod +x fix-dependencies.sh

./fix-dependencies.sh

```

### 5. Start the Development Server

```bash

npm run dev

```

## Troubleshooting

### TypeScript Errors

If you see "Cannot find module 'react'" errors:

1. Make sure all dependencies are installed correctly
2. Check that you're using the correct import syntax in your components:
   ```typescript

   import * as React from 'react';

   import { useState, useEffect } from 'react';

   ```
3. Restart the TypeScript server in your IDE

### Path Issues

WSL uses Linux-style paths. Make sure you're using forward slashes (/) instead of backslashes (\\) in your code.

### Performance Issues

If you experience slow performance when running the development server in WSL:

1. Store your project files in the Linux filesystem (e.g., /home/username/projects) rather than the Windows filesystem (/mnt/c/...)
2. Use WSL 2 instead of WSL 1 for better performance
3. Consider using Visual Studio Code with the Remote - WSL extension for a better development experience