【问题标题】:How to resolve NPM dependency problem with shadow-cljs using react-swipeable-views?如何使用 react-swipeable-views 解决 shadow-cljs 的 NPM 依赖问题?
【发布时间】:2019-11-06 16:10:41
【问题描述】:

我有一个使用 shadow-cljs 的 ClojureScript 项目。在这个项目中,我使用的是 NPM 包@material-ui,效果很好。

现在我想使用react-swipeable-views。为此我延长了我的package.json:

"dependencies": {
    "@material-ui/core": "^4.5.2",
    "@material-ui/icons": "^4.5.1",
    "highlight.js": "9.15.10",
    "react": "^16.11.0",
    "react-dom": "^16.11.0",
    "react-flip-move": "3.0.3",
    "react-highlight.js": "1.0.7",
    "react-swipeable-views": "0.13.3"
  }

当我尝试要求 ["react-swipeable-views" :as sv] 时,我从 shadow-cljs 收到此错误:

所需的 JS 依赖“dom-helpers/transition/properties”不是 可用,它是由 “node_modules/react-swipeable-views/lib/SwipeableViews.js”。

而事实上,node_modules/dom-helpers/ 中并没有 transition 目录。但是node_modules/react-swipeable-views/src/SwipeableViews.js中有import transitionInfo from 'dom-helpers/transition/properties';

它看起来像react-swipeable-views 中的依赖错误,但我是 NPM 的新手。

有什么建议吗?或者如何调试?

更新

它接缝react-swipeable-views 取决于过时的dom-helpers@3.4.0shadow-cljs 使用当前的dom-helpers@5.1.3。见https://github.com/oliviertassinari/react-swipeable-views/issues/542

可以同时使用吗?还是我必须等到有人修复react-swipeable-views

【问题讨论】:

    标签: npm dependencies shadow-cljs react-swipeable-views


    【解决方案1】:

    您正确地确定这是由版本冲突引起的。

    无法同时使用两个版本,您必须解决此版本冲突。您可以尝试将较旧的dom-helpers 版本添加到您的package.jsonnpm install 中作为默认版本。也许使用新库的库仍然可以与旧库一起使用?

    【讨论】:

    • 降级 dom-helpers 会破坏其他东西。 dom-helpers 更改了主要版本(不同的 api)。看起来我的项目已经坏了,直到 react-swipeable-views 得到升级。 :-(
    • 为什么不尝试强制安装 react-swipeable-views ?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-10
    • 1970-01-01
    • 2019-05-30
    • 2021-12-02
    相关资源
    最近更新 更多