Vue和Vue-template-compiler版本> " 2.1.4"在浏览器中出错

时间:2016-12-21 11:57:18

标签: vue.js vuejs2 quasar-framework

一切都很好,花花公子。然后我将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$2.Vue._render (eval at <anonymous> (http://localhost:8080/js/app.js:794:1), <anonymous>:2952:22)
    at Vue$2.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$2.Vue._mount (eval at <anonymous> (http://localhost:8080/js/app.js:794:1), <anonymous>:2188:19)
    at Vue$2.$mount (eval at <anonymous> (http://localhost:8080/js/app.js:794:1), <anonymous>:5978:15)
    at install$2 (eval at <anonymous> (http://localhost:8080/js/app.js:1509:1), <anonymous>:1223:29)
    at Object.install$$1 [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?

2 个答案:

答案 0 :(得分:1)

在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将我带到那里。

答案 1 :(得分:0)

这似乎是同一个问题,正如here所提出的那样。您应该将vue-template-compiler升级到2.2.0,这应该修复它。