Download mobile/scripts/old/fix-react-native-symlinks.bat from Anirudh1950/MentraOS: direct link, hf CLI and curl.
- Browser
- Download file 2.22 kB
-
https://huggingface.co/Anirudh1950/MentraOS/resolve/main/mobile/scripts/old/fix-react-native-symlinks.bat
- Command line
-
hf download hf://Anirudh1950/MentraOS/mobile/scripts/old/fix-react-native-symlinks.bat
-
curl -L -o fix-react-native-symlinks.bat https://huggingface.co/Anirudh1950/MentraOS/resolve/main/mobile/scripts/old/fix-react-native-symlinks.bat
2.22 kB
| @echo off | |
| REM Fix React Native library symlinks for Windows users | |
| REM This script creates symlinks to avoid node command execution during Android builds | |
| REM Automatically runs after npm install via postinstall script | |
| setlocal enabledelayedexpansion | |
| REM Check if node_modules exists | |
| if not exist "node_modules" ( | |
| echo π‘ No node_modules directory found, skipping symlink creation | |
| exit /b 0 | |
| ) | |
| echo π§ Creating React Native symlinks to avoid node command execution... | |
| REM Change to script directory | |
| cd /d "%~dp0" | |
| REM Counter for created symlinks | |
| set count=0 | |
| REM Create symlinks for all react-native-* libraries | |
| for /d %%d in (node_modules\react-native-*) do ( | |
| REM Check if the directory exists and create node_modules subfolder if needed | |
| if exist "%%d" ( | |
| if not exist "%%d\node_modules" ( | |
| mkdir "%%d\node_modules" 2>nul | |
| ) | |
| REM Check if symlink doesn't already exist | |
| if not exist "%%d\node_modules\react-native" ( | |
| REM Create symbolic link (requires admin privileges or developer mode) | |
| mklink /D "%%d\node_modules\react-native" "..\..\react-native" >nul 2>&1 | |
| if !errorlevel! equ 0 ( | |
| echo β Created symlink for %%d | |
| set /a count+=1 | |
| ) else ( | |
| REM Fallback: try junction if mklink fails | |
| mklink /J "%%d\node_modules\react-native" "..\..\react-native" >nul 2>&1 | |
| if !errorlevel! equ 0 ( | |
| echo β Created junction for %%d | |
| set /a count+=1 | |
| ) else ( | |
| echo β Failed to create symlink/junction for %%d | |
| echo π‘ Try running as administrator or enabling Developer Mode | |
| ) | |
| ) | |
| ) | |
| ) | |
| ) | |
| if !count! equ 0 ( | |
| echo π‘ All React Native symlinks already exist or none were needed | |
| ) else ( | |
| echo π Created !count! React Native symlinks successfully! | |
| ) | |
| echo π‘ This fixes the 'command node not found' error during Android builds. | |
| echo π‘ If symlinks failed, try running as administrator or enabling Windows Developer Mode. | |
| endlocal |