Setting up the LS Pay Admin UI
Setting up
You will need:
- Visual Studio Code
- Available here: https://code.visualstudio.com/Download
- Node.js and npm
- Available here: https://nodejs.org/en/
- You will need to restart Visual Studio Code after installing this.
Building and running the project
Building the project for the first time:
- Open a terminal in VS Code (Terminal > New Terminal).
- Run npm install to install the project's dependencies.
- Run npm install -g vite and wait for Vite to install.
- Run vite build.
To view the UI in dev mode (port 3000):
- Open a terminal in VS Code (Terminal > New Terminal).
- Run vite.
- To stop the project running, press Ctrl+C.
To view the UI in production mode (port 5050):
- Open a terminal in VS Code (Terminal > New Terminal).
- Run vite build.
- Run vite preview.
- To stop the project running, press Ctrl+C.
Errors and how to fix
"The term 'npm' is not recognized as the name of a cmdlet, function, script file or operable program."
Reason: Npm is not installed or VS Code has not been restarted after installing Npm.
Fix: Follow the link above to install Npm, or restart VS Code if it has already been installed.
"'vite' is not recognized as the name of a cmdlet"
Reason: Vite is not installed.
Fix: In a VS Code terminal, run npm install -g vite.
"vite.ps1 cannot be loaded because running scripts is disabled on this system"
Reason: PowerShell (the default terminal used by VS Code) by default restricts running scripts.
Fix: You can switch to using the cmd terminal or configure your Powershell settings by following the steps below:
-
Open the dropdown next to the '+' sign on the right hand side of the terminal window > Configure terminal settings > Edit in settings.json".
-
Input these settings in settings.json:
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell",
"args": ["-ExecutionPolicy", "Bypass"]
}
},
"terminal.integrated.defaultProfile.windows": "PowerShell",
- Save and close settings.json.
- Open a new terminal and the new settings take effect.