小编Tia*_*Qin的帖子

反应/节点构建错误。找不到模块“history”的声明文件。'node_modules/history/index.js' 隐式具有 'any' 类型

我的项目突然出现构建错误。我当前的存储库仍然没有问题,只有当我将存储库克隆到新文件夹并再次安装包然后执行 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 } …
Run Code Online (Sandbox Code Playgroud)

javascript node.js npm history.js reactjs

6
推荐指数
1
解决办法
1万
查看次数

标签 统计

history.js ×1

javascript ×1

node.js ×1

npm ×1

reactjs ×1