【问题标题】:VueJS reinstall dependenciesVueJS 重新安装依赖
【发布时间】:2017-05-21 01:40:35
【问题描述】:

我已经使用 VueJS 2 开发了几个星期,并尝试部署到生产环境,但遇到了问题。我想在不同的系统上进行测试,所以我删除了我的 node_modules 文件夹并重建了我的依赖项(npm install)。但是,当我现在 npm run dev 时,它不再起作用了。我没有更改 package.json 中的任何内容。我的网页出现以下错误:

您正在开发模式下运行 Vue。 确保在部署生产时打开生产模式。 在https://vuejs.org/guide/deployment.html查看更多提示

(unknown) ReferenceError: _h is not defined
at Proxy.render (eval at (app.js:1596), :3:14658)
at VueComponent.Vue._render (eval at (app.js:606), :3096:22)
at VueComponent.eval (eval at (app.js:606), :2464:21)
at Watcher.get (eval at (app.js:606), :1663:27)
at new Watcher (eval at (app.js:606), :1655:12)
at VueComponent.Vue._mount (eval at (app.js:606), :2463:19)
at VueComponent.Vue$3.$mount (eval at (app.js:606), :6104:15)
at VueComponent.Vue$3.$mount (eval at (app.js:606), :8494:16)
at init (eval at (app.js:606), :2777:11)
at createComponent (eval at (app.js:606), :4120:9)
logError

这怎么可能?

【问题讨论】:

    标签: vuejs2


    【解决方案1】:

    错误似乎来自vue-template-compiler,也被描述为here。解决方案可以是将 vue 降级到之前的 2.1.5,因为这是引入错误的地方(也将 vue-template-compiler 降级到相同版本)。

    我又找到了一个引用 here,它指向 this 提交。

    【讨论】:

    • 好的,我试试。但我没有使用 vue-template-compiler(它不在我的依赖项中)。到目前为止工作得很好。我需要它吗?
    • 另外,我似乎无法降级我的 Vue。我在package.json里改成2.1.8,后来改回2.0.1。但是,我的 Vue devtools 一直告诉我我正在运行 2.1.8。我删除了所有节点模块并重新安装!它从哪里获得 2.1.8?
    • @Cake 您可能没有直接使用它,但可能是您正在使用的某个包的依赖项,您可以看到所有依赖于vue-template-compiler here 的包。
    猜你喜欢
    • 2020-04-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-15
    • 2020-01-19
    • 2017-08-27
    • 2011-07-21
    • 2016-08-21
    相关资源
    最近更新 更多