npm - 由于包版本不匹配,Vue 安装失败 - 如何修复?

标签 npm vue.js codesandbox

这是错误信息:

Vue packages version mismatch:

- vue@2.5.2
- vue-template-compiler@2.5.13

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.

    at Object.<anonymous> (/Users/me/test-dev/vue-test/node_modules/vue-template-compiler/index.js:8:9)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/me/test-dev/vue-test/node_modules/vue-loader/lib/parser.js:1:80)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)

 @ ./src/router/index.js 4:0-38
 @ ./src/index.js
 @ multi ./build/dev-client ./src/index.js

> Listening at http://localhost:8080

我尝试了两个建议:更新和重新安装。两者似乎都没有帮助。

这是我设置工作演示的 codesandbox 的链接。我从 codesandbox 下载示例作为一个包(请参阅第一个链接上的下载按钮),然后在本地运行 npm install (Mac OS X Sierra)。

代码框: https://codesandbox.io/s/1rxq4j1on3

演示: https://1rxq4j1on3.codesandbox.io/Sort

最佳答案

Vue 和 vue 模板编译器必须使用相同的版本。

最新的 vue 版本是:2.5.13

https://www.npmjs.com/package/vue

npm install vue

最新模板编译器版本:2.5.13

https://www.npmjs.com/package/vue-template-compiler

npm install vue-template-compiler

将相同版本的每个添加到您的 package.json 或通过命令行安装

关于npm - 由于包版本不匹配,Vue 安装失败 - 如何修复?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48511232/

相关文章:

npm - node-sass 和 gulp-sass 的优缺点

windows - npm 不会安装 node sass

reactjs - Npm 审计显示创建新的 React Native 项目时存在 9 个漏洞

vue.js - 如何清除 vuex store 中的状态?

vue.js - Vue 3 包更新错误

angular - CodeSandBox:Angular:错误类型错误:html2canvas_1.default 不是函数

angular - 如何将 angular cli 从 1.0.1 降级到 1.0.0

javascript - 通过文件://from Vue-cli template打开index.html

html - 试图将图像放置在固定位置。为什么在我刷新页面之前图像放错了位置?

javascript - React Search 标题结果和 Pagination Material UI