最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】Vue packages version mismatch [email protected] [email protected]

Vue crifan 8356浏览 0评论

折腾:

【已解决】npm WARN [email protected] requires a peer of [email protected]^2.5.2 but none was installed

期间,升级vue到2.5.2后,结果npm run dev出错:

  HeadquarterReport git:(permission-control) ✗ npm run dev
> [email protected] dev /Users/crifan/dev/dev_root/xxx
> node build/dev-server.js
> Starting dev server…
ERROR  Failed to compile with 3 errors
error  in ./src/App.vue
Module build failed: Error:
Vue packages version mismatch:
This may cause things to work incorrectly. Make sure to use the same version for both.
If you are using [email protected]>=10.0, simply update vue-template-compiler.
If you are using [email protected]<10.0 or vueify, re-installing vue-loader/vueify should bump vue-template-compiler to the latest.
    at Object.<anonymous> (/Users/crifan/dev/dev_root/xxx/node_modules/vue-template-compiler/index.js:8:9)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/crifan/dev/dev_root/xxxnode_modules/vue-loader/lib/parser.js:1:78)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)

vue-template-compiler vue mismatch

vue-template-compiler

vuejs/vue: A progressive, incrementally-adoptable JavaScript framework for building UI on the web.

npm – Vue.js 2.3.2 version mismatch – Stack Overflow

重新删除掉:node_modules

后,就可以了。

注意到此处的:

package.json

中有指定:

“vue-template-compiler”: “2.4.2”,

以及:

“vue-loader”: “13.0.4”,

“vue-style-loader”: “3.0.1”,

和:

“vue-router”: “2.7.0”,

“vuex”:  “2.3.1″

所以感觉是:

删除掉vue-template-compiler

然后重新安装就可以了。

vue.js – How do I fix a “Vue packages version mismatch” error on Laravel Spark v4.0.9? – Stack Overflow

Vue 2.0.3 packages version mismatch · Issue #3941 · vuejs/vue

Re-install vue-loader.

npm update vue

打算,去删除掉vue-loader,重新安装vue-loader

先去看看,此处vue的几个模块的依赖情况:

npm list

找到和vue相关的:

│ ├─┬ [email protected]
│ │ └── [email protected] deduped
│ ├── [email protected]
│ ├── [email protected]
│ └── [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ ├── [email protected] deduped
│ ├── [email protected]
│ ├── [email protected] deduped
│ └── [email protected]
│ ├── [email protected] deduped
│ └─┬ [email protected]
│   ├── [email protected] deduped
│   ├── [email protected] deduped
│   └── [email protected] deduped
│ ├── [email protected]
│ └── [email protected]

此处的vue-template-compiler不依赖其他的。

去找找:

vue-template-compiler

结果不存在这个库了

好像就是属于vue内部的库了。

但是别处也是可以单独安装的:

Please Update vue-template-compiler to the latest version · Issue #1002 · JeffreyWay/laravel-mix

Vue packages version mismatch error · Issue #470 · vuejs/vue-loader

npm install vue-template-compiler –save-dev

所以去卸载和重装vue-template-compiler

➜  HeadquarterReport git:(permission-control) ✗ npm uninstall vue-template-compiler -D
[email protected] node_modules/de-indent
[email protected] node_modules/vue-template-compiler
npm WARN [email protected] requires a peer of [email protected]^2.0.0 but none was installed.
npm WARN [email protected] No repository field.
➜  HeadquarterReport git:(permission-control) ✗ npm install vue-template-compiler -D
[email protected] /Users/crifan/dev/dev_root/xxx
  └── [email protected]
npm WARN [email protected] No repository field.

对应的package.json中也有了最新版本的:

“vue-template-compiler”: “^2.5.2”,

重新npm run dev,结果就可以了。

【总结】

此处升级到vue的2.5.2,结果npm run dev报错:

Vue packages version mismatch:

[email protected]

[email protected]

的原因是:

package.json中的devDependencies存在之前的旧版本的vue-template-compiler:

“vue-template-compiler”: “2.4.2”,

和最新的2.5.2的vue不匹配。

解决办法:

卸载重装vue-template-compiler:

npm uninstall vue-template-compiler -D

npm install vue-template-compiler -D

即可。

转载请注明:在路上 » 【已解决】Vue packages version mismatch [email protected] [email protected]

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
90 queries in 0.120 seconds, using 20.59MB memory