Diferencia entre revisiones de «React Native»
De TechShareRoom wiki
Más acciones
m Texto reemplazado: «<syntaxhighlight lang="bash ">» por «<syntaxhighlight lang="bash" copy>» |
|||
| Línea 1: | Línea 1: | ||
== Instalación == | == Instalación == | ||
<syntaxhighlight lang="bash "> | <syntaxhighlight lang="bash" copy> | ||
sudo pacman -S nodejs npm nvm | sudo pacman -S nodejs npm nvm | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Línea 7: | Línea 7: | ||
Una vez la app descargada donde toca... | Una vez la app descargada donde toca... | ||
<syntaxhighlight lang="bash "> | <syntaxhighlight lang="bash" copy> | ||
npm install | npm install | ||
npm run build | npm run build | ||
| Línea 14: | Línea 14: | ||
Si falta alguna dependencia | Si falta alguna dependencia | ||
<syntaxhighlight lang="bash "> | <syntaxhighlight lang="bash" copy> | ||
npm install -D @vitejs/plugin-react | npm install -D @vitejs/plugin-react | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Línea 20: | Línea 20: | ||
Solucionando permisos. No suele ser necesario, funciona sin hacer esto: | Solucionando permisos. No suele ser necesario, funciona sin hacer esto: | ||
<syntaxhighlight lang="bash "> | <syntaxhighlight lang="bash" copy> | ||
sudo chown -R www-data:www-data /var/www/html/mi-app | sudo chown -R www-data:www-data /var/www/html/mi-app | ||
sudo chmod -R 755 /var/www/html/mi-app | sudo chmod -R 755 /var/www/html/mi-app | ||
| Línea 28: | Línea 28: | ||
vite.config.ts y pon: | vite.config.ts y pon: | ||
<syntaxhighlight lang="bash "> | <syntaxhighlight lang="bash" copy> | ||
import { defineConfig } from 'vite'; | import { defineConfig } from 'vite'; | ||
import react from '@vitejs/plugin-react'; | import react from '@vitejs/plugin-react'; | ||
| Línea 38: | Línea 38: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<syntaxhighlight lang="bash "> | <syntaxhighlight lang="bash" copy> | ||
http://localhost:5173/ | http://localhost:5173/ | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Línea 45: | Línea 45: | ||
=== Recargar package.json.lock === | === Recargar package.json.lock === | ||
<syntaxhighlight lang="bash "> | <syntaxhighlight lang="bash" copy> | ||
rm -rf package-lock.json node_modules | rm -rf package-lock.json node_modules | ||
npm install | npm install | ||
| Línea 55: | Línea 55: | ||
Forma tradicional, más lenta y segura | Forma tradicional, más lenta y segura | ||
<syntaxhighlight lang="bash "> | <syntaxhighlight lang="bash" copy> | ||
npm outdated | npm outdated | ||
#Examples | #Examples | ||
| Línea 66: | Línea 66: | ||
Forma moderna, rápida y un poco peligrosa | Forma moderna, rápida y un poco peligrosa | ||
<syntaxhighlight lang="bash "> | <syntaxhighlight lang="bash" copy> | ||
npx npm-check-updates | npx npm-check-updates | ||
npx npm-check-updates -u | npx npm-check-updates -u | ||
| Línea 72: | Línea 72: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<syntaxhighlight lang="bash "> | <syntaxhighlight lang="bash" copy> | ||
# Escanea vulnerabilidades | # Escanea vulnerabilidades | ||
npm audit | npm audit | ||
| Línea 86: | Línea 86: | ||
Modificar package.json y luego | Modificar package.json y luego | ||
<syntaxhighlight lang="bash "> | <syntaxhighlight lang="bash" copy> | ||
npm install | npm install | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Línea 93: | Línea 93: | ||
== Apache == | == Apache == | ||
<syntaxhighlight lang="bash ">Alias /electric-car-saving-calculator /var/www/html/motorshareroom/electric-car-saving-calculator</syntaxhighlight> | <syntaxhighlight lang="bash" copy>Alias /electric-car-saving-calculator /var/www/html/motorshareroom/electric-car-saving-calculator</syntaxhighlight> | ||
<syntaxhighlight lang="bash "> | <syntaxhighlight lang="bash" copy> | ||
<Directory /var/www/html/motorshareroom/electric-car-saving-calculator> | <Directory /var/www/html/motorshareroom/electric-car-saving-calculator> | ||
Options Indexes FollowSymLinks | Options Indexes FollowSymLinks | ||
Revisión actual - 14:01 26 ene 2026
Instalación
sudo pacman -S nodejs npm nvmUna vez la app descargada donde toca...
npm install
npm run build
npm run devSi falta alguna dependencia
npm install -D @vitejs/plugin-reactSolucionando permisos. No suele ser necesario, funciona sin hacer esto:
sudo chown -R www-data:www-data /var/www/html/mi-app
sudo chmod -R 755 /var/www/html/mi-appSi se sirve desde subruta cambiar la base en vite.config.ts y pon:
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig({
base: '/electric-car-saving-calculator/',
plugins: [react()],
});http://localhost:5173/Si se quiere mover la app a otra parte, mover el contenido de la carpeta dist en la carpeta que se quiera del servidor.
Recargar package.json.lock
rm -rf package-lock.json node_modules
npm install
npm run dev
npm run buildActualizar dependencias
Forma tradicional, más lenta y segura
npm outdated
#Examples
npm updated
#Specific
npm install --save-dev @types/react@latest @types/react-dom@latest
npm install @vitejs/plugin-react@latest
npm install vite@latestForma moderna, rápida y un poco peligrosa
npx npm-check-updates
npx npm-check-updates -u
npm install# Escanea vulnerabilidades
npm audit
# Arregla automáticamente vulnerabilidades que se pueden corregir sin romper nada
npm audit fix
# Para forzar actualización de vulnerabilidades graves incluso si hay cambios de breaking
npm audit fix --forceActualizar versión app
Modificar package.json y luego
npm installSe acatualizará package-lock.json con los cambios
Apache
Alias /electric-car-saving-calculator /var/www/html/motorshareroom/electric-car-saving-calculator <Directory /var/www/html/motorshareroom/electric-car-saving-calculator>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>