My project is suddenly having a build error. My current repo still has no problem, it only happens when I clone the repo to a new folder and install the package again then do npm run build. So I am so scared to update the package right now...
I checked the merge history, I don't think any code merge should cause this issue..
Here is the error message I got:
$ npm run build
> [email protected] 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';
| ^
This is the package.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.
I tried:
- delete the node_module --> npm install --> npm run build --> same error
- clone the project again --> npm install --> npm run build --> same error
- clone the older version of the project --> npm install --> npm run build --> same error
Nothing seems to work.