尝试编译React项目时出现错误“无法读取null的属性'绑定'”

时间:2019-09-17 12:40:56

标签: reactjs visual-studio babel package.json

使用npm install --save <package-from-package.json>@latest更新各种软件包后,将无法再启动React中的UI项目(在Visual Studio Professional 2017中为开发人员模式)。前端错误消息是:

bootstrap:83 Uncaught Error: Module build failed (from ./node_modules/babel-loader/lib/index.js):
TypeError: Cannot read property 'bindings' of null
    at Scope.moveBindingTo (C:\myProject\node_modules\@babel\traverse\lib\scope\index.js:860:13)
    at BlockScoping.updateScopeInfo 

我(在Stackoverflow上)做了一些研究,建议是更改.babelrc内的内容,而该内容到目前为止是空的,因此我想这不可能。错误消息告诉我什么?

背景

这里摘录自package.json

  "dependencies": {
    "@types/react-select": "*",
    "antd": "^3.23.2",
    "babel-polyfill": "6.23.0",
    "babel-preset-react": "^6.24.1",
    "download": "6.2.5",
    "draft-js": "^0.11.0",
    "immutable": "3.8.2",
    "jquery": "^3.4.1",
    "mini-css-extract-plugin": "^0.8.0",
    "moment": "^2.24.0",
    "react-lazy-load": "^3.0.13",
    "react-router": "^5.0.1",
    "react-router-dom": "^5.0.1",
    "redux": "3.6.0",
    "redux-saga": "^1.1.0",
    "reselect": "3.0.1",
    "whatwg-fetch": "^3.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.6.0",
    "@babel/node": "^7.6.1",
    "@babel/preset-env": "^7.6.0",
    "@babel/preset-react": "^7.0.0",
    "@types/node": "^12.7.5",
    "@types/react": "^16.9.2",
    "@types/react-dom": "0.14.23",
    "@types/react-redux": "4.4.40",
    "@types/react-router-dom": "^4.3.5",
    "@types/react-router-redux": "5.0.0",
    "ajv": "^6.10.2",
    "awesome-typescript-loader": "^5.2.1",
    "babel-core": "6.26.3",
    "babel-loader": "^8.0.6",
    "babel-plugin-transform-es2015-parameters": "6.24.1",
    "babel-preset-env": "1.7.0",
    "css-loader": "^3.2.0",
    "less": "2.7.3",
    "less-loader": "4.1.0",
    "react": "^16.9.0",
    "react-dom": "^16.9.0",
    "react-redux": "^7.1.1",
    "react-router-redux": "^4.0.8",
    "source-map-loader": "^0.2.4",
    "style-loader": "0.17.0",
    "ts-loader": "^6.1.0",
    "typescript": "^3.6.3",
    "webpack": "^4.40.2"
  }

参考文献

0 个答案:

没有答案