Error “Cannot read property 'bindings' of null” when trying to compile React project

ⅰ亾dé卋堺 提交于 2019-12-11 17:42:39

问题


After updating various packages with npm install --save <package-from-package.json>@latest, our UI-project in React can no longer be started (in developer mode in Visual Studio Professional 2017). The frontend error message is:

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 

I did some research (on Stackoverflow), and the suggestion is to change stuff within .babelrc which was up to now empty, so I suppose that cannot be the thing to do. What does the error message tell me?

Background

Here an extract from 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"
  }

References

  • Upgrade to Babel 7: Cannot read property 'bindings' of null and in particular one answer
  • TypeError: Cannot read property 'bindings' of null
  • React build issue, ERROR in ./src/index.js Module build failed (from ./node_modules/babel-loader/lib/index.js):

来源:https://stackoverflow.com/questions/57974434/error-cannot-read-property-bindings-of-null-when-trying-to-compile-react-pro

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!