Tia*_*Qin 6 javascript node.js npm history.js reactjs
我的项目突然出现构建错误。我当前的存储库仍然没有问题,只有当我将存储库克隆到新文件夹并再次安装包然后执行 npm run build 时才会发生这种情况。所以我现在很害怕更新软件包......
我检查了合并历史记录,我认为任何代码合并都不会导致此问题。
这是我收到的错误消息:
$ 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';
| ^
Run Code Online (Sandbox Code Playgroud)
这是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.
Run Code Online (Sandbox Code Playgroud)
我试过:
似乎什么都不起作用。