本文介绍了babel JS文件无法解析"@ babel/runtime/helpers/builtin/classCallCheck";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在休息时,我的项目运行良好,直到删除了我的node_modules文件并尝试重新安装npm软件包.

我收到此错误

./node_modules/react-event-listener/dist/react-event-listener.cjs.js
Module not found: Can't resolve '@babel/runtime/helpers/builtin/classCallCheck' in '/Users/suatkarabacak/Desktop/demarkedashboard/node_modules/react-event-listener/dist'

我的package.json看起来像这样.

{
  "name": "demo",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "admin-on-rest": "^1.4.1",
    "aor-dependent-input": "^1.2.0",
    "aor-parseserver-client": "0.3.0",
    "aor-rich-text-input": "^1.0.1",
    "babel-runtime": "^6.26.0",
    "parse": "^1.11.1",
    "parse-react": "^0.5.2",
    "prop-types": "^15.6.2",
    "react": "^15.6.2",
    "react-dom": "^15.6.2",
    "react-image-lightbox": "^4.6.0",
    "react-images": "^0.5.19"
  },
  "devDependencies": {
    "@babel/runtime": "^7.0.0-beta.56",
    "aor-color-input": "^1.2.1",
    "babel-polyfill": "^6.23.0",
    "react-scripts": "^1.1.4"
  },
  "homepage": "demo.html",
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}

没有内置文件夹.

可能是什么问题?

解决方案

由于Babel 7.x仍是Beta版,因此beta.56发生了重大变化,该变化已于昨天发布.

"@babel/runtime": "^7.0.0-beta.56",

如果您正在使用某产品的Beta版本,则在版本号中使用^是危险的,因为这意味着它将接受任何最新版本,无论它实际上是否与以前的Beta版本兼容./p>

由于react-scripts使用 https://github.com/facebook/create-react-app/blob/1407287839f94151cec729bd89441d4eee7d9dd3/packages/babel-preset-react-app/package.json#L28

您应该有

"@babel/runtime": "7.0.0-beta.46",

在您自己的package.json中进行匹配.

on-rest my project was working great untill I delete my node_modules file and try to re-install npm package.

I am getting this error

./node_modules/react-event-listener/dist/react-event-listener.cjs.js
Module not found: Can't resolve '@babel/runtime/helpers/builtin/classCallCheck' in '/Users/suatkarabacak/Desktop/demarkedashboard/node_modules/react-event-listener/dist'

My package.json is looking like this.

{
  "name": "demo",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "admin-on-rest": "^1.4.1",
    "aor-dependent-input": "^1.2.0",
    "aor-parseserver-client": "0.3.0",
    "aor-rich-text-input": "^1.0.1",
    "babel-runtime": "^6.26.0",
    "parse": "^1.11.1",
    "parse-react": "^0.5.2",
    "prop-types": "^15.6.2",
    "react": "^15.6.2",
    "react-dom": "^15.6.2",
    "react-image-lightbox": "^4.6.0",
    "react-images": "^0.5.19"
  },
  "devDependencies": {
    "@babel/runtime": "^7.0.0-beta.56",
    "aor-color-input": "^1.2.1",
    "babel-polyfill": "^6.23.0",
    "react-scripts": "^1.1.4"
  },
  "homepage": "demo.html",
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}

There is no builtin folder.

What could be the problem ?

解决方案

Since Babel 7.x is still a beta version, there was a breaking change in beta.56, which was released yesterday.

"@babel/runtime": "^7.0.0-beta.56",

If you're using a beta version of something, it is dangerous to use ^ in your version number, because that means it will accept any recent version, whether or not it is actually compatible with previous beta versions.

Since react-scripts uses https://github.com/facebook/create-react-app/blob/1407287839f94151cec729bd89441d4eee7d9dd3/packages/babel-preset-react-app/package.json#L28

Your should likely have

"@babel/runtime": "7.0.0-beta.46",

in your own package.json to match.

这篇关于babel JS文件无法解析"@ babel/runtime/helpers/builtin/classCallCheck";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 04:54