javascript - react running error
高洛峰
高洛峰 2017-05-16 13:38:59
0
1
1144

Another question
/q/10...

This is my configuration

  {
  "name": "mantaweb",
  "version": "1.0.0",
  "description": "",
  "main": "web/index.html",
  "scripts": {
    "build": "./node_modules/.bin/webpack --config webpack/webpack.build.config.js --progress --colors",
    "dev": "./node_modules/.bin/webpack-dev-server --config webpack/webpack.dev.config.js --progress --colors --inline --hot --host 10.1.240.18",
    "home": "./node_modules/.bin/webpack-dev-server --config webpack/webpack.dev.config.js --progress --colors --inline --hot --host 192.168.5.102",
    "gz": "./node_modules/.bin/webpack-dev-server --config webpack/webpack.dev.config.js --progress --colors --inline --hot --host 192.168.1.109",
    "local": "./node_modules/.bin/webpack-dev-server --config webpack/webpack.dev.config.js --progress --colors --inline --hot"
  },
  "author": "Shaohua.Gu",
  "license": "wrapbootstrap",
  "homepage": "",
  "devDependencies": {
    "antd": "^2.1.0",
    "autoprefixer": "^6.3.6",
    "autoprefixer-loader": "^3.2.0",
    "babel-core": "^6.17.0",
    "babel-loader": "^6.2.5",
    "babel-plugin-antd": "^0.5.1",
    "babel-plugin-import": "^1.0.1",
    "babel-plugin-transform-object-rest-spread": "^6.6.5",
    "babel-preset-es2015": "^6.6.0",
    "babel-preset-react": "^6.5.0",
    "classnames": "^2.2.3",
    "clean-webpack-plugin": "^0.1.8",
    "copy-to-clipboard": "^3.0.5",
    "css-loader": "^0.23.1",
    "echarts": "^3.2.2",
    "file-loader": "^0.8.5",
    "history": "^2.0.1",
    "jquery": "^2.2.2",
    "jquery-slimscroll": "^1.3.6",
    "json-loader": "^0.5.4",
    "less": "^2.6.1",
    "less-loader": "^2.2.3",
    "lodash": "^4.6.1",
    "moment": "^2.15.1",
    "postcss-loader": "^0.8.2",
    "precss": "^1.4.0",
    "react": "^15.3.2",
    "react-bootstrap-validation": "^0.1.11",
    "react-copy-to-clipboard": "^4.1.0",
    "react-dom": "^15.3.2",
    "react-hot-loader": "^1.3.0",
    "react-markdown": "^2.2.0",
    "react-router": "^2.8.1",
    "redux": "^3.3.1",
    "reflux": "^0.4.0",
    "style-loader": "^0.13.1",
    "url-loader": "^0.5.7",
    "webpack": "^1.15.0",
    "webpack-dev-server": "^1.14.1",
    "yargs": "^4.3.2"
  },
  "dependencies": {
    "autoprefixer": "^6.7.7",
    "clean-webpack-plugin": "^0.1.16",
    "lodash": "^4.17.4",
    "precss": "^1.4.0",
    "press": "0.0.2",
    "react": "^0.14.7",
    "react-dom": "^15.5.4",
    "yargs": "^4.8.1"
  }
}

================================================ =========
npm run build exploded with the following warning

WARNING in ./~/react/dist/react.min.js
Critical dependencies:
12:407-414 This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results.
 @ ./~/react/dist/react.min.js 12:407-414

WARNING in ./~/react-dom/dist/react-dom.min.js
Critical dependencies:
12:478-485 This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results.
 @ ./~/react-dom/dist/react-dom.min.js 12:478-485

================================================ =========================
npm run local exploded warning

ERROR in ./~/react-dom/lib/ReactDOMUnknownPropertyHook.js
Module not found: Error: Cannot resolve 'file' or 'directory' E:\heShengWeb\manta-web\node_modules\react\lib/ReactComponentTreeHook in E:\heShengWeb\manta-web\node_modules\react-dom\lib
 @ ./~/react-dom/lib/ReactDOMUnknownPropertyHook.js 15:29-72

ERROR in ./~/react-dom/lib/ReactDOMNullInputValuePropHook.js
Module not found: Error: Cannot resolve 'file' or 'directory' E:\heShengWeb\manta-web\node_modules\react\lib/ReactComponentTreeHook in E:\heShengWeb\manta-web\node_modules\react-dom\lib
 @ ./~/react-dom/lib/ReactDOMNullInputValuePropHook.js 13:29-72

ERROR in ./~/react-dom/lib/ReactDOMInvalidARIAHook.js
Module not found: Error: Cannot resolve 'file' or 'directory' E:\heShengWeb\manta-web\node_modules\react\lib/ReactComponentTreeHook in E:\heShengWeb\manta-web\node_modules\react-dom\lib
 @ ./~/react-dom/lib/ReactDOMInvalidARIAHook.js 14:29-72

ERROR in ./~/react-dom/lib/ReactDebugTool.js
Module not found: Error: Cannot resolve 'file' or 'directory' E:\heShengWeb\manta-web\node_modules\react\lib/ReactComponentTreeHook in E:\heShengWeb\manta-web\node_modules\react-dom\lib
 @ ./~/react-dom/lib/ReactDebugTool.js 16:29-72

ERROR in ./~/react-dom/lib/instantiateReactComponent.js
Module not found: Error: Cannot resolve 'file' or 'directory' E:\heShengWeb\manta-web\node_modules\react\lib/getNextDebugID in E:\heShengWeb\manta-web\node_modules\react-dom\lib
 @ ./~/react-dom/lib/instantiateReactComponent.js 20:21-56

ERROR in ./~/react-dom/lib/ReactChildReconciler.js
Module not found: Error: Cannot resolve 'file' or 'directory' E:\heShengWeb\manta-web\node_modules\react\lib/ReactComponentTreeHook in E:\heShengWeb\manta-web\node_modules\react-dom\lib
 @ ./~/react-dom/lib/ReactChildReconciler.js 29:27-70 37:31-74

ERROR in ./~/react-dom/lib/flattenChildren.js
Module not found: Error: Cannot resolve 'file' or 'directory' E:\heShengWeb\manta-web\node_modules\react\lib/ReactComponentTreeHook in E:\heShengWeb\manta-web\node_modules\react-dom\lib
 @ ./~/react-dom/lib/flattenChildren.js 26:27-70 42:33-76

ERROR in ./~/react-dom/lib/checkReactTypeSpec.js
Module not found: Error: Cannot resolve 'file' or 'directory' E:\heShengWeb\manta-web\node_modules\react\lib/ReactComponentTreeHook in E:\heShengWeb\manta-web\node_modules\react-dom\lib
 @ ./~/react-dom/lib/checkReactTypeSpec.js 29:27-70 71:37-80
webpack: Failed to compile.

我到底哪里有问题呢,公司的电脑可以运行,我把代码git clone到自己的电脑上运行就爆了怎么多问题,我还把node_modules删了,重新npm install都不行:X
高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(1)
phpcn_u1582

package.jsondependenciesdevDependencies There are two versions of react and react-dom.

Check whether there is any difference in the version of node_modules/react between the two computers.

If you have yarn.lock you can install it through yarn install and make sure the versions are the same.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template