【问题标题】:Working on a PR for DefinitelyTyped. How can I fix "Cannot find module 'csstype'" when I run "npm run lint markdown-to-jsx"?为DefiniteTyped 做公关。当我运行“npm run lint markdown-to-jsx”时,如何修复“找不到模块'csstype'”?
【发布时间】:2020-06-08 08:29:48
【问题描述】:

这是我到目前为止按照https://github.com/DefinitelyTyped/DefinitelyTyped#verifying 上的说明所做的工作。

我分叉了https://github.com/DefinitelyTyped/DefinitelyTyped。

我 git 克隆了我的 fork 并运行 npm install。

我更新了types/markdown-to-jsx的类型定义和测试。

现在,运行 npm run lint markdown-to-jsx 会返回错误。

为什么?

npm run lint markdown-to-jsx

> definitely-typed@0.0.3 lint /Users/sunknudsen/tmp/DefinitelyTyped
> dtslint types "markdown-to-jsx"

Error: Errors in typescript@next for external dependencies:
../react/index.d.ts(34,22): error TS2307: Cannot find module 'csstype'.

【问题讨论】:

    标签: typescript definitelytyped


    【解决方案1】:

    您是否在types/<your-package-name> 中尝试过npm install,就您而言:

    cd types/markdown-to-jsx && npm i;
    

    ?它应该修复它。

    如果没有,您可能只是在树的某处需要安装一些依赖项。我看到这些是markdown-to-jsx 的类型,所以我建议在react、react-dom 和react-markdown 的类型文件夹中也运行npm i。

    我遇到了类似的问题,并在types/react 中运行它(当然除了在我的项目类型中运行它)解决了它:

    cd types/react && npm i
    

    【讨论】:

    猜你喜欢
    • 2023-02-15
    • 2018-09-17
    • 2021-09-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-29
    • 1970-01-01
    • 2019-04-05
    相关资源
    最近更新 更多