Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs React 16.2.0显示错误“;无法读取属性';ReactCurrentOwner';“未定义”的定义;_Reactjs_Npm_Npm Install - Fatal编程技术网

Reactjs React 16.2.0显示错误“;无法读取属性';ReactCurrentOwner';“未定义”的定义;

Reactjs React 16.2.0显示错误“;无法读取属性';ReactCurrentOwner';“未定义”的定义;,reactjs,npm,npm-install,Reactjs,Npm,Npm Install,我在用react@15.6.2但当时正在尝试更新到16.2.0 我已删除node_modules文件夹,然后执行npm cache clean和npm install 但是,控制台会一直显示此消息 未满足的对等依赖react@15.6.2无效 在我运行webpack服务器后,浏览器只会抛出一条错误消息: 无法读取未定义的属性“ReactCurrentOwner” 为什么会发生这种情况 以下是my package.json的外观: "devDependencies": { "autop

我在用react@15.6.2但当时正在尝试更新到16.2.0

我已删除node_modules文件夹,然后执行
npm cache clean
npm install

但是,控制台会一直显示此消息

未满足的对等依赖react@15.6.2无效

在我运行webpack服务器后,浏览器只会抛出一条错误消息:

无法读取未定义的属性“ReactCurrentOwner”

为什么会发生这种情况

以下是my package.json的外观:

  "devDependencies": {
    "autoprefixer": "^6.3.6",
    "babel-core": "^6.8.0",
    "babel-loader": "^6.2.4",
    "babel-plugin-transform-class-properties": "^6.8.0",
    "babel-plugin-transform-runtime": "^6.8.0",
    "babel-preset-es2015": "^6.6.0",
    "babel-preset-react": "^6.5.0",
    "babel-preset-stage-0": "^6.5.0",
    "css-loader": "^0.23.1",
    "eslint": "^2.9.0",
    "eslint-config-airbnb": "^9.0.1",
    "eslint-plugin-import": "^1.8.0",
    "eslint-plugin-jsx-a11y": "^1.2.0",
    "eslint-plugin-react": "^5.1.1",
    "extract-text-webpack-plugin": "^1.0.1",
    "file-loader": "^0.8.5",
    "firebase": "^4.13.0",
    "history": "^4.7.2",
    "html-webpack-plugin": "^2.16.1",
    "install": "^0.11.0",
    "less": "^2.7.1",
    "less-loader": "^2.2.3",
    "open-browser-webpack-plugin": "0.0.2",
    "postcss-loader": "^2.1.4",
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "react-icons": "^2.2.7",
    "react-route": "^1.0.3",
    "react-router-dom": "^4.2.2",
    "rimraf": "^2.5.2",
    "style-loader": "^0.13.1",
    "styled-components": "^3.2.3",
    "url-loader": "^0.5.7",
    "webpack": "^1.13.0",
    "webpack-dev-server": "^1.14.1"
  }

我刚刚解决了这个问题

困扰我的是,即使删除node_modules文件夹,包的版本也会保持不变(旧版本)。我仍然不知道为什么

因此,我卸载了
react
react dom
,因为
npm ls react
的错误消息表明:
npm错误!缺少对等dep:react@^16.0.0,react需要-dom@16.2.0


在通过执行
npm install重新安装它们之后react@16.2.0
npm安装响应-dom@16.2.0
,浏览器的错误消息消失!:)

了解什么取决于v15
npm ls react