Prerequisites
npm Installation
npm (Node Package Manager) is a tool for managing Node.js packages, essential for both front-end and back-end projects. In most cases, npm is installed alongside Node.js.
Step 1: Install Node.js (including npm)
- Visit the official Node.js website and download the installer.
- Choose the LTS (Long Term Support) version for stability.
- Run the installer and follow the instructions.
Step 2: Verify the npm Installation
- Open a terminal or command prompt.
- Enter the command:
- If the terminal displays a version number, npm has been successfully installed.
Step 3: Update npm (Optional)
To update npm globally to the latest version, run:
Software and Hardware Requirements
- IDE: DevEco Studio 5.0.3 (downloaded and configured)
- OpenHarmony SDK API: 12 (downloaded)
- Huawei Developer Account: Required to generate signing configurations
- Device/Emulator: An installed OH emulator, a device with HarmonyNEXT, or a 64-bit version of OpenHarmony
OpenHarmony Overview
Building the React Native Framework from Source
Cloning the Repository
Follow these steps to clone the project repository:
- Open a terminal or command prompt.
- Run the following command to clone the repository:
- Change to the newly created project directory:
- Initialize and update all submodules:
- Once cloning and submodule updating are complete, the project is ready for further setup and development.
Compilation of the Framework and Sample Tester Application
- Open a terminal and navigate to the
react-native-harmony-cli
directory, then run: - Navigate to the
react-native-harmony-sample-package
directory, then run: -
Enter the
(Note: Use 'npm run i' instead of 'npm i'.)tester
directory and run: -
While in the
tester
directory, start the Metro server: - Set the environment variable
RNOH_C_API_ARCH
to1
. - Open the
tester/harmony
project in DevEco Studio and wait for background synchronization to complete. - Connect your device.
- In DevEco Studio, navigate to File > Project Structure > Signing Configs, log in, and follow the signing process.
- Select the
entry
configuration located at the top-right. - Click the Run 'entry' button at the top-right to launch the project.