Javascript package.json依赖关系问题?-&引用;未捕获引用错误:未定义react“;

Javascript package.json依赖关系问题?-&引用;未捕获引用错误:未定义react“;,javascript,npm,node-modules,dependency-management,package.json,Javascript,Npm,Node Modules,Dependency Management,Package.json,我遇到了一个问题,我的构建在主分支上运行良好,但在子分支上它产生了一个错误“uncaughtreferenceerror:react未定义”。两个分支的package.json略有不同,但我仍然不确定为什么分支会显示错误,因为React被列为这两个分支的依赖项 总分行: { "name": "master-branch", "version": "0.0.1", "description": "master-branch", "main": "lib/index.js", "

我遇到了一个问题,我的构建在主分支上运行良好,但在子分支上它产生了一个错误“uncaughtreferenceerror:react未定义”。两个分支的package.json略有不同,但我仍然不确定为什么分支会显示错误,因为React被列为这两个分支的依赖项

总分行:

{
  "name": "master-branch",
  "version": "0.0.1",
  "description": "master-branch",
  "main": "lib/index.js",
  "pre-commit": [
    "test"
  ],
  "peerDependencies": {
    "antd": "3.x",
    "react": "16.x",
    "react-dom": "16.x"
  },
  "scripts": {
    "build": "rm -rf lib && NODE_ENV=production webpack --progress --config webpack.config.js ",
    "docs:clean": "rm -rf docs/dist",
    "docs:deploy": "yarn docs && gh-pages -d docs/dist",
    "docs": "esdoc && yarn test:coverage && node docs/post-doc",
    "test": "NODE_ENV=test jest",
    "test:coverage": "jest --coverage",
    "test:watch": "jest --watch",
    "watch": "watch-run -p 'src/**' yarn build",
    "storybook": "start-storybook -p 6006",
    "storybook:watch": "concurrently \"yarn watch\" \"yarn storybook\"",
    "storybook:build": "build-storybook -c .storybook -o build-stories"
  },
  "babel": {
    "presets": [
      "es2015",
      "stage-0",
      "react"
    ],
    "plugins": [
      "transform-class-properties",
      "transform-custom-element-classes",
      "transform-es2015-classes",
      "transform-export-extensions"
    ]
  },
  "jest": {
    "coverageDirectory": "docs/dist/coverage"
  },
  "dependencies": {
    "antd": "3.6.5",
    "async": "^2.6.0",
    "axios": "^0.19.0",
    "chance": "^1.0.13",
    "classnames": "^2.2.5",
    "jquery": "^3.2.1",
    "lodash": "^4.17.15",
    "md5": "^2.2.1",
    "react-jss": "^8.4.0",
    "store": "^2.0.12"
  },
  "devDependencies": {
    "@storybook/addon-actions": "^5.2.5",
    "@storybook/addon-links": "^5.2.5",
    "@storybook/react": "^5.2.5",
    "babel-cli": "^6.26.0",
    "babel-core": "^6.26.3",
    "babel-loader": "^7.1.4",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-plugin-transform-custom-element-classes": "^0.1.0",
    "babel-plugin-transform-es2015-classes": "^6.24.1",
    "babel-plugin-transform-export-extensions": "^6.22.0",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "babel-preset-stage-0": "^6.24.1",
    "esdoc": "^1.0.3",
    "esdoc-ecmascript-proposal-plugin": "^1.0.0",
    "esdoc-react-plugin": "^1.0.1",
    "esdoc-standard-plugin": "^1.0.0",
    "gh-pages": "^1.0.0",
    "jest": "^23.6.0",
    "pre-commit": "^1.2.2",
    "react": "^16.3.2",
    "react-dom": "^16.3.2",
    "react-test-renderer": "^16.0.0",
    "url-loader": "^1.1.1",
    "watch-run": "^1.2.5",
    "webpack": "^3.8.1",
    "webpack-cli": "^2.0.4"
  },
  "author": "",
  "homepage": "",
  "license": "MIT",
  "repository": "",
  "keywords": [
    "react-component"
  ]
}
支行:

{
  "name": "sub-branch",
  "version": "0.0.1",
  "description": "sub-branch",
  "main": "lib/index.js",
  "pre-commit": [
    "test"
  ],
  "peerDependencies": {
    "antd": "3.6.5",
    "classnames": "^2.2.6",
    "prop-types": "^15.7.2",
    "react": "16.8",
    "react-dom": "^16.9.0",
    "react-jss": "^8.6.1"
  },
  "scripts": {
    "build": "rm -rf lib && NODE_ENV=production webpack --mode production --progress --config webpack.config.js ",
    "docs:clean": "rm -rf docs/dist",
    "docs:deploy": "yarn docs && gh-pages -d docs/dist",
    "docs": "esdoc && yarn test:coverage && node docs/post-doc",
    "test": "NODE_ENV=test jest",
    "test:coverage": "jest --coverage",
    "test:watch": "jest --watch",
    "watch": "watch-run -p 'src/**' yarn build",
    "storybook": "start-storybook -p 6006",
    "storybook:watch": "concurrently \"yarn watch\" \"yarn storybook\""
  },
  "jest": {
    "coverageDirectory": "docs/dist/coverage"
  },
  "dependencies": {
    "@storybook/addon-storysource": "^5.2.0",
    "antd": "^3.23.3",
    "axios": "^0.16.2",
    "chance": "^1.0.13",
    "classnames": "^2.2.6",
    "lodash": "^4.17.4",
    "md5": "^2.2.1",
    "prop-types": "^15.7.2",
    "react": "16.8",
    "react-dom": "16.8",
    "react-jss": "^8.6.1",
    "store": "^2.0.12"
  },
  "devDependencies": {
    "@babel/cli": "^7.6.0",
    "@babel/core": "^7.6.0",
    "@babel/plugin-proposal-class-properties": "^7.5.5",
    "@babel/plugin-proposal-export-default-from": "^7.5.2",
    "@babel/plugin-syntax-export-extensions": "^7.0.0-beta.32",
    "@babel/plugin-transform-classes": "^7.5.5",
    "@babel/preset-env": "^7.6.0",
    "@babel/preset-react": "^7.0.0",
    "@storybook/addon-actions": "^5.2.0",
    "@storybook/addon-notes": "^5.2.1",
    "@storybook/react": "^5.2.0",
    "babel-loader": "^8.0.6",
    "esdoc": "^1.0.3",
    "esdoc-ecmascript-proposal-plugin": "^1.0.0",
    "esdoc-react-plugin": "^1.0.1",
    "esdoc-standard-plugin": "^1.0.0",
    "flexbox-react": "^4.4.0",
    "gh-pages": "^1.0.0",
    "jest": "^24.9.0",
    "pre-commit": "^1.2.2",
    "react-popper-tooltip": "^2.8.3",
    "react-test-renderer": "^16.9.0",
    "react-textarea-autosize": "^7.1.0",
    "simplebar-react": "^1.3.0-alpha.1",
    "storybook-addon-react-docgen": "^1.2.18",
    "url-loader": "^1.1.1",
    "watch-run": "^1.2.5",
    "webpack": "^4.40.2",
    "webpack-cli": "^3.3.8"
  },
  "author": "",
  "homepage": "",
  "license": "MIT",
  "repository": "",
  "keywords": [
    "react-component"
  ]
}


在主分支上,
react
被定义为“依赖性”,但在子分支上被定义为“依赖性”。我认为支行也应将其定义为“DevDependence”

16.8是无效版本