javascript - 错误: Couldn't find preset "react-hmre" relative to directory

标签 javascript node.js reactjs babeljs

我有以下库 https://github.com/codyc4321/react-data-components-updated

我将它安装在我的 React 项目中,例如 npm i ~/react-data-components-updated

现在运行我的 Node 服务器,我得到:

ERROR in /Users/cchilders/react-data-components-updated/lib/index.js
Module build failed: Error: Couldn't find preset "react-hmre" relative to directory "/Users/cchilders/react-data-components-updated"
    at /Users/cchilders/work_projects/myproject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:293:19
    at Array.map (native)
    at OptionManager.resolvePresets (/Users/cchilders/work_projects/myproject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
    at OptionManager.mergePresets (/Users/cchilders/work_projects/myproject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
    at OptionManager.mergeOptions (/Users/cchilders/work_projects/myproject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)
    at OptionManager.init (/Users/cchilders/work_projects/myproject/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
    at File.initOptions (/Users/cchilders/work_projects/myproject/node_modules/babel-core/lib/transformation/file/index.js:212:65)
    at new File (/Users/cchilders/work_projects/myproject/node_modules/babel-core/lib/transformation/file/index.js:135:24)
    at Pipeline.transform (/Users/cchilders/work_projects/myproject/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
    at transpile (/Users/cchilders/work_projects/myproject/node_modules/babel-loader/lib/index.js:46:20)
 @ ./client/components/tables/MyDataTable.js 64:16-56
 @ ./client/controllers/MyController.js
 @ ./client/main.js
 @ multi webpack-hot-middleware/client ./client/main.js

我的图书馆里有

.babelrc

{
  "presets": [
    "es2015",
    "react",
    "stage-1",
    "react-hmre"
  ]
}

package.json

{
  "name": "react-data-components-updated",
  "version": "0.1.0",
  "description": "React data components updated with some fixes",
  "keywords": [
    "pagination",
    "react",
    "react-component",
    "table"
  ],
  "license": "MIT",
  "main": "./lib/index",
  "files": [
    "css",
    "lib",
    "dist",
    "src"
  ],
  "repository": {
    "type": "git",
    "url": "https://github.com/codyc4321/react-data-components-updated"
  },
  "dependencies": {
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "lodash": "^4.13.1",
    "prop-types": "^15.5.10"
  },
  "peerDependencies": {
    "react": "^0.14.0 || ^15.0.0-0"
  },
  "devDependencies": {
    "babel-cli": "^6.10.1",
    "babel-core": "^6.10.4",
    "babel-eslint": "^7.0.0",
    "babel-jest": "^20.0.3",
    "babel-loader": "^7.1.1",
    "babel-plugin-lodash": "^3.2.4",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.5.0",
    "babel-preset-stage-1": "^6.5.0",
    "eslint": "^4.1.1",
    "eslint-plugin-react": "^7.1.0",
    "flow-bin": "^0.49.1",
    "husky": "^0.14.1",
    "jest": "^20.0.4",
    "lint-staged": "^4.0.0",
    "lodash-webpack-plugin": "^0.11.4",
    "prettier": "^1.5.2",
    "react": "^15.1.0",
    "react-addons-test-utils": "^15.1.0",
    "react-dom": "^15.1.0",
    "react-redux": "^4.4.5",
    "react-test-renderer": "^15.6.1",
    "redux": "^3.5.2",
    "rimraf": "^2.4.3",
    "webpack": "^3.1.0",
    "webpack-dev-server": "^2.5.0"
  },
  "scripts": {
    "build": "webpack && babel src -d lib",
    "check": "flow check",
    "clean": "rimraf lib dist coverage",
    "lint": "eslint src",
    "precommit": "lint-staged",
    "prepublish": "npm run clean && npm run build",
    "start": "webpack-dev-server -d --config example/webpack.config.js",
    "test": "npm run lint && npm run check && jest"
  },
  "lint-staged": {
    "*.js": [
      "prettier --write --single-quote --trailing-comma all",
      "git add"
    ]
  },
  "jest": {
    "roots": [
      "src"
    ]
  }
}

如何修复此 react-hmre 错误?

最佳答案

您错过了该软件包,请点击安装babel-preset-react-hmre

关于javascript - 错误: Couldn't find preset "react-hmre" relative to directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45743193/

相关文章:

javascript - 在javascript DOM元素更改后将php变量插入数据库

javascript - 如何在 Angular toastr 上显示倒计时器

node.js - 尝试仅删除数字后面的字符 F 或 C

node.js - Apollo GraphQL 中的上下文与 RootValue

Javascript 函数调用顺序

javascript - React Context 无法使用 Provider

javascript - 每次提交页面时显示加载器 MVC Asp.net

javascript - React Native Redux Reducer 不工作

javascript - 微前端在 react

javascript - 使用静态 React 函数的返回值