Bootstrap突然无法用于我的React JS项目

时间:2018-02-05 16:22:10

标签: node.js reactjs bootstrap-4 react-bootstrap package.json

蓝色引导程序已停止处理我的项目。我不知道为什么。

这是我们的package.json:

  {
  "name": "blankets",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "amazon-cognito-identity-js": "^1.26.0",
    "aws-sdk": "^2.151.0",
    "bootstrap": "^4.0.0",
    "jwt-decode": "^2.2.0",
    "prop-types": "^15.6.0",
    "react": "^16.1.1",
    "react-bootstrap": "^0.31.5",
    "react-dom": "^16.1.1",
    "react-router-dom": "^4.2.2",
    "react-scripts": "1.0.17",
    "react-select": "^1.0.0-rc.10"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}

这是我们在index.html中的导入

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css">

非常感谢任何帮助/建议/建议!谢谢!

1 个答案:

答案 0 :(得分:3)

这:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css">

正在加载最新版本的Bootstrap 4.0.0。

因为Bootstrap 4与Bootstrap 3完全不兼容,会破坏你的布局。

解决方案:

加载bootstrap 3的css(以及相应的js)文件或迁移到Bootstrap 4.

Bootstrap 3链接:

https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css

https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js