Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

361
Views
Error de compilación de reacción/nodo. No se pudo encontrar un archivo de declaración para el módulo 'historial'. 'node_modules/history/index.js' implícitamente tiene un tipo 'cualquiera'

Mi proyecto de repente tiene un error de compilación. Mi repositorio actual todavía no tiene ningún problema, solo sucede cuando clono el repositorio en una nueva carpeta e instalo el paquete nuevamente y luego ejecuto npm build. Así que tengo tanto miedo de actualizar el paquete ahora mismo...

Revisé el historial de combinación, no creo que ninguna combinación de código deba causar este problema.

Aquí está el mensaje de error que recibí:

 $ npm run build > container-client@2.32.0 build I:\ds\projects\new\container-service\client > craco build Creating an optimized production build... Failed to compile. I:/ds/projects/new/container-service/client/src/views/add-application/AddApplicationPage.tsx TypeScript error in I:/ds/projects/new/container-service/client/src/views/add-application/AddApplicationPage.tsx(4,25): Could not find a declaration file for module 'history'. 'I:/ds/projects/new/container-service/client/node_modules/history/index.js' implicitly has an 'any' type. If the 'history' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/history` TS7016 2 | import './_index.scss'; 3 | import store from '../../store'; > 4 | import { History } from 'history'; | ^

Este es el paquete.json:

 { "private": false, "dependencies": { "axios": "^0.19.2", "bootstrap": "^4.6.0", "history": "^4.10.1", "identity-obj-proxy": "^3.0.0", "react": "~17.0.1", "react-app-polyfill": "~2.0.0", "react-dom": "~17.0.1", "react-router-dom": "~5.2.0" }, Looks like the library "history" is causing the problem.

Lo intenté:

  1. elimine el node_module --> npm install --> npm run build --> mismo error
  2. clone el proyecto nuevamente --> npm install --> npm run build --> mismo error
  3. clone la versión anterior del proyecto --> npm install --> npm run build --> mismo error

Nada parece funcionar.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

el problema parece ser del paquete de history que está utilizando

No se pudo encontrar un archivo de declaración para el módulo 'historial'.

intente instalar tipos para el paquete

npm i @tipos/historia

si eso no funcionó, cambie la importación para requerir

const historia = require("historia")

actualizar

@types/history está en desuso y desde la versión 5 de history , las declaraciones de tipo se proporcionan dentro del propio paquete. actualizar el paquete debería solucionar el problema:

 npm install history@latest
over 4 years ago · Santiago Trujillo Report

0

Parece que el nuevo history necesita una biblioteca de dependencias @types/history . Hice un npm i @types/history@4.7.9 y luego hice un npm i nuevamente. Esto solucionó mi problema.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!