como resuelvo esto PS C:\Users\Jesus…
- User
como resuelvo esto PS C:\Users\Jesus Rodriguez\Desktop\RamaMasterBackend\Healthy-Human-master> npm install --timeout=99999999999999999999999999 npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: '@angular-devkit/core@16.2.8', npm WARN EBADENGINE required: { npm WARN EBADENGINE node: '^16.14.0 || >=18.10.0', npm WARN EBADENGINE npm: '^6.11.0 || ^7.5.6 || >=8.0.0', npm WARN EBADENGINE yarn: '>= 1.13.0' npm WARN EBADENGINE }, npm WARN EBADENGINE current: { node: 'v18.7.0', npm: '8.15.0' } npm WARN EBADENGINE } npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: '@angular-devkit/schematics@16.2.8', npm WARN EBADENGINE required: { npm WARN EBADENGINE node: '^16.14.0 || >=18.10.0', npm WARN EBADENGINE npm: '^6.11.0 || ^7.5.6 || >=8.0.0', npm WARN EBADENGINE yarn: '>= 1.13.0' npm WARN EBADENGINE }, npm WARN EBADENGINE current: { node: 'v18.7.0', npm: '8.15.0' } npm WARN EBADENGINE } npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: '@angular-devkit/schematics-cli@16.2.8', npm WARN EBADENGINE required: { npm WARN EBADENGINE node: '^16.14.0 || >=18.10.0', npm WARN EBADENGINE npm: '^6.11.0 || ^7.5.6 || >=8.0.0', npm WARN EBADENGINE yarn: '>= 1.13.0' npm WARN EBADENGINE }, npm WARN EBADENGINE current: { node: 'v18.7.0', npm: '8.15.0' } npm WARN EBADENGINE } npm WARN deprecated vm2@3.9.19: The library contains critical security issues and should not be used for production! The maintenance of the project has been discontinued. Consider migrating your code to isolated-vm. npm WARN cleanup Failed to remove some directories [ npm WARN cleanup [ npm WARN cleanup 'C:\Users\Jesus Rodriguez\Desktop\RamaMasterBackend\Healthy-Human-master\node_modules\@nestjs\schematics', npm WARN cleanup [Error: EPERM: operation not permitted, lstat 'C:\Users\Jesus Rodriguez\Desktop\RamaMasterBackend\Healthy-Human-master\node_modules@nestjs\schematics'] { npm WARN cleanup errno: -4048, npm WARN cleanup code: 'EPERM', npm WARN cleanup syscall: 'lstat', npm WARN cleanup path: 'C:\Users\Jesus Rodriguez\Desktop\RamaMasterBackend\Healthy-Human-master\node_modules\@nestjs\schematics'
npm WARN cleanup } npm WARN cleanup ] npm WARN cleanup ] npm ERR! code 1 npm ERR! path C:\Users\Jesus Rodriguez\Desktop\RamaMasterBackend\Healthy-Human-master\node_modules\bcrypt npm ERR! command failed npm ERR! command C:\Windows\system32\cmd.exe /d /s /c C:\Users\JESUSR~1\AppData\Local\Temp\install-44ce72ef.cmd npm ERR! node:internal/modules/cjs/loader:372 npm ERR! throw err; npm ERR! ^ npm ERR! npm ERR! Error: Cannot find module 'C:\Users\Jesus Rodriguez\Desktop\RamaMasterBackend\Healthy-Human-master\node_modules\util-deprecate\node.js'. Please verify that the package.json has a valid "main" entry npm ERR! at tryPackage (node:internal/modules/cjs/loader:364:19) npm ERR! at Module._findPath (node:internal/modules/cjs/loader:577:18) npm ERR! at Module._resolveFilename (node:internal/modules/cjs/loader:942:27) npm ERR! at Module._load (node:internal/modules/cjs/loader:804:27) npm ERR! at Module.require (node:internal/modules/cjs/loader:1022:19) npm ERR! at require (node:internal/modules/cjs/helpers:102:18) npm ERR! at Object. (C:\Users\Jesus Rodriguez\Desktop\RamaMasterBackend\Healthy-Human-master\node_modules\are-we-there-yet\node_modules\readable-stream\lib_stream_writable.js:58:14) npm ERR! at Module._compile (node:internal/modules/cjs/loader:1120:14) npm ERR! at Module._extensions..js (node:internal/modules/cjs/loader:1174:10) npm ERR! at Module.load (node:internal/modules/cjs/loader:998:32) { npm ERR! code: 'MODULE_NOT_FOUND', npm ERR! path: 'C:\Users\Jesus Rodriguez\Desktop\RamaMasterBackend\Healthy-Human-master\node_modules\util-deprecate\package.json', npm ERR! requestPath: 'util-deprecate' npm ERR! } npm ERR! npm ERR! Node.js v18.7.0npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Jesus Rodriguez\AppData\Local\npm-cache_logs\2023-11-27T18_32_13_483Z-debug-0.log
- Assistant
Este error parece indicar que hay problemas con las dependencias y las versiones de Node.js y npm que estás utilizando. Aquí hay algunos pasos que puedes seguir para intentar solucionarlo:
-
Verifica que estés utilizando una versión compatible de Node.js. Según los mensajes de advertencia, se requiere Node.js versión 16.14.0 o mayor o versión 18.10.0 o mayor. Puedes verificar la versión de Node.js que tienes instalada escribiendo
node --versionen tu terminal. -
Verifica que estés utilizando una versión compatible de npm. Según los mensajes de advertencia, se requiere npm versión 6.11.0 o mayor, versión 7.5.6 o mayor, o versión 8.0.0 o mayor. Puedes verificar la versión de npm que tienes instalada escribiendo
npm --versionen tu terminal. -
Si la versión de Node.js o npm que tienes instalada no es compatible, actualízalas a una versión compatible. Puedes hacer esto descargándolas desde la página oficial de Node.js (https://nodejs.org/) e instalándolas nuevamente.
-
Una vez que hayas actualizado Node.js y npm, intenta nuevamente ejecutar el comando
npm install --timeout=99999999999999999999999999en tu directorio de proyecto. Esto iniciará el proceso de instalación de las dependencias del proyecto.
Si después de estos pasos sigues experimentando problemas, puede haber otro problema en tu entorno de desarrollo. En ese caso, sería útil revisar el archivo de registro completo (
2023-11-27T18_32_13_483Z-debug-0.log) mencionado al final del mensaje de error para obtener más información sobre el problema específico que está ocurriendo. -
- User
comopongo aqui 2 select? uno para genero y otro para rol import SmallLogo from "./SmallLogo" import { useState } from "react" import axios from "axios"; import "./signup.css"; import { Link } from "react-router-dom";
export default function SignUp() { const [user, setUser] = useState({ name: "", email: "", password: "", })
const handleChange = (e) => { const name = e.target.name; const value = e.target.value; setUser({ ...user, [name]: value }); }
const [error, setError] = useState([]); const [eState, setEstate] = useState(false);
function submit() { try { console.log(user); axios .post("http://localhost:3000/api/v1/auth/signup", user) .then((res) => { if (res.data.status === 400) { setError([res.data.message]); setEstate(true); } if (res.data.status === 422) { setError(res.data.error); setEstate(true); } else { setError([res.data.message]); setEstate(true); setTimeout(() => { // changeState("signin") }, 1000); } }) .catch((err) => { console.log(err); }); } catch (err) { console.log(err); } setUser({ name: "", email: "", password: "", }) }
return ( <div style={{ marginTop: "-180px", width: "10px" }}> Healthy human Bienvenido
<div className="signUpLogin"> <p className="login"><Link className="link" to="/signin">Iniciar sesion</Link></p> <p className="signUp"><Link className="link" to="/signup">Registrarse</Link></p> </div> <div className="details"> <label><p style={{ color: "lightgrey", marginTop: "5px" }}>Nombre</p></label> <input className="email" value={user.name} type="text" name="name" onChange={handleChange} /> <br /> <label><p style={{ color: "lightgrey" }}>Correo electronico</p></label> <input className="email" value={user.email} type="text" name="email" onChange={handleChange} /> <br /> <label><p style={{ color: "lightgrey" }}>Contraseña</p></label> <input className="password" value={user.password} type="password" name="password" onChange={handleChange} /> </div> {eState ? <div className="errorDivSU"><div className="allErrSU">{error.map((e) => <p key={e}>{e}</p>)}</div> <button onClick={() => setEstate(false)}>x</button></div> : ""} <button className="signinbtn" onClick={submit}> Registarse</button> </div>) }
- Assistant
Para agregar dos elementos
<select>en tu componenteSignUp, uno para el género y otro para el rol, puedes seguir estos pasos:- Agrega dos estados usando el hook
useStatepara almacenar los valores seleccionados de los<select>. Por ejemplo:
const [gender, setGender] = useState(""); const [role, setRole] = useState("");- Agrega los elementos
<select>en el bloque de códigoreturnde tu componente. Puedes usar la propvaluepara establecer el valor seleccionado y la proponChangepara manejar los eventos de selección. Por ejemplo:
<div className="details"> <label><p style={{ color: "lightgrey", marginTop: "5px" }}>Nombre</p></label> <input className="email" value={user.name} type="text" name="name" onChange={handleChange} /> <br /> <label><p style={{ color: "lightgrey" }}>Correo electronico</p></label> <input className="email" value={user.email} type="text" name="email" onChange={handleChange} /> <br /> <label><p style={{ color: "lightgrey" }}>Contraseña</p></label> <input className="password" value={user.password} type="password" name="password" onChange={handleChange} /> <label><p style={{ color: "lightgrey" }}>Género</p></label> <select value={gender} onChange={(e) => setGender(e.target.value)}> <option value="">Selecciona</option> <option value="masculino">Masculino</option> <option value="femenino">Femenino</option> </select> <label><p style={{ color: "lightgrey" }}>Rol</p></label> <select value={role} onChange={(e) => setRole(e.target.value)}> <option value="">Selecciona</option> <option value="administrador">Administrador</option> <option value="usuario">Usuario</option> </select> </div>- Actualiza el objeto
useren el estado cuando se seleccionen opciones en los<select>. Puedes hacerlo en la funciónhandleChange. Por ejemplo:
const handleChange = (e) => { const name = e.target.name; const value = e.target.value; setUser((prevUser) => ({ ...prevUser, [name]: value, })); }- Actualiza el objeto que envías en la petición POST con los valores seleccionados. Por ejemplo:
const submit = () => { const userData = { ...user, gender: gender, role: role, }; // Resto del código... };Estos pasos te ayudarán a agregar dos elementos
<select>en tu componente y almacenar los valores seleccionados en los estados correspondientes. Asegúrate de ajustar los nombres de los estados y las variables según sea necesario en tu caso. - Agrega dos estados usando el hook