Babel Error: Cannot find module 'babel-runtime/core-js/json/stringify'

Babel Error: Cannot find module 'babel-runtime/core-js/json/stringify'

我正在试用 Vue,首先是使用 Webpack,它运行顺利,所以现在我尝试将它与 Brunch 集成,因为它是 Phoenix 使用的,但我得到了这个神秘的错误:

Cannot find module 'babel-runtime/core-js/json/stringify'

我试图从我原来的 Webpack 项目的 package.json 中复制所有与 babel 相关的依赖项,但我仍然得到同样的错误,我不知道为什么。 我尝试使用纱线,尝试删除 node_modules 然后重新安装,尝试了不同版本的 babel-runtime 无济于事。 我当前的 package.json 看起来像这样:

"dependencies": {
"node-sass": "^4.5.2",
"phoenix": "file:deps/phoenix",
"phoenix_html": "file:deps/phoenix_html",
"pug": "^2.0.0-rc.1",
"sass-brunch": "^2.10.4",
"vue": "^2.3.3",
"vue-brunch": "^2.0.1",
"vue-resource": "^1.3.1",
"vue-router": "^2.5.3"
},
"devDependencies": {
  "css-loader": "^0.28.1",
  "webpack": "^2.5.1",
  "babel-brunch": "~6.0.0",
  "brunch": "2.7.4",
  "clean-css-brunch": "~2.0.0",
  "css-brunch": "~2.0.0",
  "javascript-brunch": "~2.0.0",
  "uglify-js-brunch": "~2.0.1",
  "babel-core": "^6.22.1",
  "babel-loader": "^6.2.10",
  "babel-plugin-istanbul": "^4.1.1",
  "babel-plugin-transform-runtime": "^6.22.0",
  "babel-preset-env": "^1.3.2",
  "babel-preset-stage-2": "^6.22.0",
  "babel-register": "^6.22.0",
  "vue-loader": "^11.3.4",
  "vue-style-loader": "^2.0.5",
  "vue-template-compiler": "^2.2.6"
},
"engines": {
  "node": ">= 4.0.0",
  "npm": ">= 3.0.0"
},
"babel": {
  "plugins": ["transform-runtime"]
}

据我所知,这与 brunch 如何加载它的模块有关。您的入口文件需要 'bootstrap' 它将使用的所有其他模块。

尝试将此行添加到您的条目文件

import 'babel-runtime/core-js/json/stringify';

您可能还需要从主文件中要求您的应用程序中需要的其他模块,您不需要在主文件中使用它们,但为了在组件中要求它们或另一个不是您的主要文件的文件,您需要执行此操作 'bootstrapping.'