【发布时间】:2021-02-28 06:40:31
【问题描述】:
我正在尝试将 vuejs 3 集成到使用 webpack 的现有项目中。我阅读了有关 vue-loader 的信息,所以我正在尝试使用它。
在官方文档中我有这个:
vue 每次发布新版本,都会同时发布对应版本的 vue-template-compiler。编译器的版本必须与基本的 vue 包同步,以便 vue-loader 生成与运行时兼容的代码。这意味着每次在项目中升级 vue 时,都应该升级 vue-template-compiler 以匹配它。
所以,当我尝试编译时,我得到了这个错误:
Vue packages version mismatch:
- vue@3.0.2 (/home/alejo/playground/parquesFrontend/node_modules/vue/index.js)
- vue-template-compiler@2.6.12 (/home/alejo/playground/parquesFrontend/node_modules/vue-template-compiler/package.json)
This may cause things to work incorrectly. Make sure to use the same version for both.
If you are using vue-loader@>=10.0, simply update vue-template-compiler.
If you are using vue-loader@<10.0 or vueify, re-installing vue-loader/vueify should bump vue-template-compiler to the latest.
但是当我尝试安装 vue-template-compiler@3.0.2 时,我得到了这个错误:
❯ npm install vue-template-compiler@3.0.2
npm ERR! code ETARGET
npm ERR! notarget No matching version found for vue-template-compiler@3.0.2.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/alejo/.npm/_logs/2020-11-17T02_52_46_458Z-debug.log
我该如何解决这个问题?
【问题讨论】:
-
查看本教程以了解没有 vue-cli 的 Vue v3 设置:frontendguruji.com/blog/…
标签: javascript vue.js webpack vuejs3 vue-loader