【问题标题】:unable to resolve module create-react-class无法解析模块 create-react-class
【发布时间】:2018-07-31 13:27:02
【问题描述】:

我是原生反应的新手。

在我的项目中实现 native-base 后,我收到此错误:

这是我的代码:

 import React, { Component } from 'react';
 import { View, Text } from 'react-native';
 import {Header,Left,Right,Icon} from 'native-base'

    export default class DiningAreas extends Component {
      constructor(props) {
      super(props);
        this.state = {
        };
    }

  render() {
    return (
      <View>
        <Header>
          <Left Icon = 'menu'/>
        </Header>
        <Text> DiningAreas </Text>
      </View>
    );
  }
}

【问题讨论】:

  • 您是否尝试过他们在错误中提到的内容?
  • 是的,我试过但不幸遇到同样的问题
  • 您使用的是最新版本的 native-base 吗?
  • @Johan 我正在使用最新版本
  • watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache verify && npm install && npm start -- --reset-cache 应该可以解决问题,这是随机发生的,所以无法重现。最后一个选项是在 node_modules 中安装 create-react-class

标签: react-native native-base


【解决方案1】:

使用以下命令清除所有内容: 守望者watch-del-all &amp;&amp; rm -rf $TMPDIR/react-* &amp;&amp; rm -rf node_modules/ &amp;&amp; npm cache verify &amp;&amp; npm install &amp;&amp; npm start -- --reset-cache 它应该修复它。

【讨论】:

  • 你试图删除 node_modules 文件夹并运行 npm i
  • 我按照您的指示一一运行了所有命令,但没有成功
  • 你正在使用 yarn 或 npm
  • 我正在使用 npm。
猜你喜欢
  • 1970-01-01
  • 2018-03-05
  • 2017-10-11
  • 2017-07-23
  • 2016-03-23
  • 1970-01-01
  • 2018-11-18
  • 2020-04-15
  • 2020-03-02
相关资源
最近更新 更多