首页 > 解决方案 > Heroku 部署:找不到模块:'react-bootstrap'。确保已安装此软件包

问题描述

构建失败

第一个 MERN 应用程序。部署到 Heroku 时遇到问题。在本地运行时一切正常。我试过卸载/重新安装 react-bootstrap。可能是什么问题呢?

这是我的 package.json:

    {
  "name": "mern-workout-app",
  "version": "0.1.0",
  "engines": {
    "node": "13.8.0"
  },
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "axios": "^0.19.2",
    "bootstrap": "^4.4.1",
    "react": "^16.13.1",
    "react-bootstrap": "^1.0.0",
    "react-dom": "^16.13.1",
    "react-router-dom": "^5.1.2",
    "react-scripts": "3.4.1",
    "styled-components": "^5.1.0"
  },
  "scripts": {
    "start": "cd backend && npm install && node index.js",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "heroku-postbild": "cd client && npm install && npm run build"
  },
  "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"
    ]
  }
}

标签: node.jsherokureact-bootstrapmern

解决方案


推荐阅读