尝试导入错误:“ react-lifecycles-compat”不包含默认导出(导入为“ reactLifecyclesCompat”)

时间:2018-12-30 17:31:45

标签: reactjs reactstrap

./ node_modules / reactstrap / dist / reactstrap.es.js

尝试的导入错误:“ react-lifecycles-compat”不包含默认导出(导入为“ reactLifecyclesCompat”)。

3 个答案:

答案 0 :(得分:2)

只需npm install --save reactstrap@6.5.0就不需要删除任何内容。干杯!

答案 1 :(得分:1)

我现在遇到了相同的错误。我不是专家,但是这对我来说是固定的。

  1. 在package.json中检查reactstrap的版本(我认为最新版本是^ 7.0.0,已于昨天发布。)
  2. 在package.json中将其更改为^ 6.5.0
  3. 删除节点模块
  4. 重新安装依赖项

答案 2 :(得分:-1)

  1. 打开private static Map<String, Long> getMapOfElementsOfXML(String xmlContent) throws ParserConfigurationException, SAXException, IOException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(false); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc1 = db.parse(new ByteArrayInputStream(xmlContent.getBytes())); NodeList entries = doc1.getElementsByTagName("*"); Map<String, Long> mapElements = new HashMap<>(); for (int i = 0; i < entries.getLength(); i++) { Element element = (Element) entries.item(i); if (element.getChildNodes().getLength() == 1&&element.getTextContent()!=null) { final String elementWithXPathAndValue = getXPath(element.getParentNode()) + "/" + element.getParentNode().getNodeName() + "/" + element.getTagName() + "/" + element.getTextContent(); Long countValue = mapElements.get(elementWithXPathAndValue); if (countValue == null) { countValue = Long.valueOf(0l); } else { ++countValue; } mapElements.put(elementWithXPathAndValue, countValue); } } return mapElements; } static String getXPath(Node node) { Node parent = node.getParentNode(); if (parent == null) { return ""; } return getXPath(parent) + "/" + parent.getNodeName(); }
  2. 从以下行中删除./node_modules/reactstrap/dist/reactstrap.es.js

    reactLifecyclesCompat,

  3. 在以下行中将import reactLifecyclesCompat, { polyfill } from 'react-lifecycles-compat';更改为reactLifecyclesCompat.polyfill

    polyfill

相关问题