【问题标题】:React project not loading after npm install and npm start在 npm install 和 npm start 后反应项目未加载
【发布时间】:2020-05-01 23:31:49
【问题描述】:

我克隆了这个 git 仓库 -> https://github.com/jbetancur/react-data-table-component

我对反应还很陌生。我尝试按照我的建议通过npm installnpm start 启动这个项目,但它显示了这个错误消息。

rollup v2.7.2

bundles ./src/index.js → dist\react-data-table-component.dev.js...

created dist\react-data-table-component.dev.js in 16.4s

[2020-05-01 13:45:31] waiting for changes...

它一直在等待。我用谷歌搜索了很多,但没有找到让这个存储库在我的系统上运行的方法。帮助将不胜感激。在此先感谢:)

【问题讨论】:

    标签: reactjs git npm


    【解决方案1】:

    如果怀疑您正在尝试使用此数据表包。 如果您尝试安装此软件包,则必须执行以下操作。

    1. 使用npx create-react-app projectName 创建反应应用
    2. 然后安装这个特定的包NPM LINK npm i react-data-table-component
    3. 然后根据文档在你的代码中使用这个包。
    import React from 'react';
    import DataTable, { createTheme } from 'react-data-table-component';
    
    createTheme('solarized', {
      text: {
        primary: '#268bd2',
        secondary: '#2aa198',
      },
      background: {
        default: '#002b36',
      },
      context: {
        background: '#cb4b16',
        text: '#FFFFFF',
      },
      divider: {
        default: '#073642',
      },
      action: {
        button: 'rgba(0,0,0,.54)',
        hover: 'rgba(0,0,0,.08)',
        disabled: 'rgba(0,0,0,.12)',
      },
    });
    
    const App = () => (
      <DataTable
        title="Arnold Movies"
        columns={columns}
        theme="solarized"
      />
    );
    
    export default App;
    

    【讨论】:

    • 我想使用这个代码 -> jbetancur.github.io/react-data-table-component/?path=/story/… 我如何使用包中的这个代码?如果我直接复制粘贴,它会要求提供“../constants/sampleRMEpisodes”和“../../../src/index”等数据文件。有什么办法可以在我的本地机器上将它作为一个项目运行?
    • 我理解你想要做什么。您可以按照这些步骤操作。创建您自己的 React 项目并使用 npm 安装此数据表包。然后你可以用示例代码替换 app.js 代码。
    • 首先它说 ./src/App.js Line 26:61: 'columns' is not defined no-undef 如果我将数据数组提供给列以至少运行它,那么它会说-> 没有要显示的记录
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-10-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-25
    相关资源
    最近更新 更多