【问题标题】:React bulma components import is not workingReact bulma 组件导入不起作用
【发布时间】:2019-11-11 07:03:00
【问题描述】:

我使用CRA (CREATE-REACT-APP) 创建了 React 应用程序。我已经安装了node-sass 并将App.css 重命名为App.scss 并在App.js 中更新了它的导入。现在在我的App.js 中,我只是想在一个部分内打印一些文本。

This is the link the repo, I am talking about. For your reference

node -v v12.11.1 和npm -v 6.11.3

App.js

import React from 'react';
import './App.scss';
import Section from 'react-bulma-components/lib/components/section';

function App() {
  return (
    <Section>
      <div class="container">
        <h1 class="title">
          Hello World
      </h1>
        <p class="subtitle">
          My first website with <strong>Bulma</strong>!
      </p>
      </div>
    </Section>
  );
}

export default App;

App.scss

@import 'react-bulma-components/src/index.sass';

package.json

{
  "name": "just-trying",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "node-sass": "^4.13.0",
    "react": "^16.11.0",
    "react-bulma-components": "^3.1.3",
    "react-dom": "^16.11.0",
    "react-router-dom": "^5.1.2",
    "react-scripts": "3.2.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "sass-loader": "^8.0.0"
  }
}

【问题讨论】:

  • 你是哪个节点版本?其节点版本问题
  • node -v v12.11.1 和 npm -v 6.11.3
  • 尝试将节点降级到 v11。

标签: reactjs create-react-app bulma


【解决方案1】:

我没有降级节点的版本,而是卸载了 react-bulma-components,而是像 npm i bulma 一样通过 npa 安装了 bulma.. 效果很好。

【讨论】:

    猜你喜欢
    • 2020-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多