Vue 和 Vue-template-compiler version > "2.1.4" 在浏览器中给出错误

Vue and Vue-template-compiler version > "2.1.4" gives error in browser

一切都很好,很漂亮。然后我将 Vue 和 Vue-template-compiler npm 包升级到 2.1.4 以上的版本,然后我的浏览器中没有任何显示,除了以下错误:

(unknown) [Vue warn]: Error when rendering root instance: warn

localhost/:2961 Uncaught ReferenceError: _h is not defined
    at Proxy.render (eval at <anonymous> (http://localhost:8080/js/app.js:1509:1), <anonymous>:1096:14)
    at Vue.Vue._render (eval at <anonymous> (http://localhost:8080/js/app.js:794:1), <anonymous>:2952:22)
    at Vue.eval (eval at <anonymous> (http://localhost:8080/js/app.js:794:1), <anonymous>:2189:21)
    at Watcher.get (eval at <anonymous> (http://localhost:8080/js/app.js:794:1), <anonymous>:1652:27)
    at new Watcher (eval at <anonymous> (http://localhost:8080/js/app.js:794:1), <anonymous>:1644:12)
    at Vue.Vue._mount (eval at <anonymous> (http://localhost:8080/js/app.js:794:1), <anonymous>:2188:19)
    at Vue.$mount (eval at <anonymous> (http://localhost:8080/js/app.js:794:1), <anonymous>:5978:15)
    at install (eval at <anonymous> (http://localhost:8080/js/app.js:1509:1), <anonymous>:1223:29)
    at Object.install$ [as install] (eval at <anonymous> (http://localhost:8080/js/app.js:1509:1), <anonymous>:6265:3)
    at Function.Vue.use (eval at <anonymous> (http://localhost:8080/js/app.js:794:1), <anonymous>:3364:22)

我的package.json:

{
  "name": "myapp",
  "version": "0.0.1",
},
  "dependencies": {
    "babel-runtime": "^6.20.0",
    "fastclick": "^1.0.6",
    "material-design-icons": "^3.0.1",
    "moment": "^2.17.1",
    "quasar-framework": "^0.9.1",
    "roboto-fontface": "^0.6.0",
    "velocity-animate": "^1.3.1",
    "vue": "2.1.4",
    "vue-router": "^2.1.1"
  },
  "devDependencies": {
    "autoprefixer": "^6.5.3",
    "babel-core": "^6.20.0",
    "babel-eslint": "^7.1.1",
    "babel-loader": "^6.2.9",
    "babel-plugin-transform-runtime": "^6.15.0",
    "babel-preset-es2015": "^6.18.0",
    "babel-preset-stage-2": "^6.18.0",
    "colors": "^1.1.2",
    "connect-history-api-fallback": "^1.3.0",
    "css-loader": "^0.26.1",
    "eslint": "^3.11.1",
    "eslint-config-standard": "^6.2.1",
    "eslint-friendly-formatter": "^2.0.6",
    "eslint-loader": "^1.6.1",
    "eslint-plugin-html": "^1.7.0",
    "eslint-plugin-promise": "^3.4.0",
    "eslint-plugin-standard": "^2.0.1",
    "eventsource-polyfill": "^0.9.6",
    "express": "^4.14.0",
    "extract-text-webpack-plugin": "^2.0.0-beta.4",
    "file-loader": "^0.9.0",
    "function-bind": "^1.1.0",
    "html-webpack-plugin": "^2.24.1",
    "http-proxy-middleware": "^0.17.3",
    "json-loader": "^0.5.4",
    "postcss-loader": "^1.2.0",
    "stylus": "^0.54.5",
    "stylus-loader": "^2.4.0",
    "url-loader": "^0.5.7",
    "vue-loader": "^10.0.2",
    "vue-html-loader": "^1.2.3",
    "vue-style-loader": "^1.0.0",
    "vue-template-compiler": "2.1.4",
    "chai": "^3.5.0",
    "karma": "^1.3.0",
    "karma-coverage": "^1.1.1",
    "karma-mocha": "^1.3.0",
    "karma-sinon-chai": "^1.2.4",
    "karma-spec-reporter": "^0.0.26",
    "karma-webpack": "^1.8.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-firefox-launcher": "^1.0.0",
    "karma-ie-launcher": "^1.0.0",
    "karma-phantomjs-launcher": "^1.0.1",
    "karma-safari-launcher": "^1.0.0",
    "karma-sauce-launcher": "^1.0.0",
    "karma-sourcemap-loader": "^0.3.7",
    "phantomjs-prebuilt": "^2.1.13",
    "sinon": "^1.17.6",
    "sinon-chai": "^2.8.0",
    "lolex": "^1.5.2",
    "mocha": "^3.2.0",
    "inject-loader": "^2.0.1",
    "isparta-loader": "^2.0.0",
    "chromedriver": "^2.25.2",
    "cross-spawn": "^4.0.2",
    "nightwatch": "^0.9.9",
    "selenium-server": "^2.53.1",
    "semver": "^5.3.0",
    "opn": "^4.0.2",
    "ora": "^0.3.0",
    "shelljs": "^0.7.4",
    "webpack": "^2.1.0-beta.27",
    "webpack-dev-middleware": "^1.8.4",
    "webpack-hot-middleware": "^2.13.2",
    "webpack-merge": "^0.18.0"
  }
}

返回到版本 2.1.4,一切又好了...我怎样才能成功更新 Vue 和 Vue-template-compiler?

这似乎是同一个问题,已被提出 here。您应该将 vue-template-compiler 升级到 2.2.0,这样应该可以解决问题。

vue中的一个方法重命名了: https://github.com/vuejs/vue/commit/4b51ad048306367a6fb6fbee7445e086d855f31e

您的代码或依赖项可能仍使用 _h。就我而言,它与 Quasar 框架有关。使用 vue-template-compiler 2.1.6 更新到 Quasar Framework 10.3 和 vue 2.1.6 后,问题解决了。看: https://github.com/quasarframework/app-template-default/issues/5

浏览 github 在 _h 上搜索,vue 把我带到了那里。