Nat*_*ter 23 vue.js laravel-spark vuejs2
当我npm run dev在Laravel Spark v4.0.9应用程序上运行时,出现以下错误:
Module build failed: Error:
Vue packages version mismatch:
- vue@2.0.8
- vue-template-compiler@2.2.6
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.
Run Code Online (Sandbox Code Playgroud)
我package.json看起来像这样:
{
"private": true,
"scripts": {
"dev": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"dependencies": {
"axios": "^0.15.2",
"bootstrap": "^3.0.0",
"cross-env": "^3.2.3",
"jquery": "^2.1.4",
"js-cookie": "^2.1.0",
"laravel-mix": "0.*",
"moment": "^2.10.6",
"promise": "^7.1.1",
"sweetalert": "^1.1.3",
"underscore": "^1.8.3",
"urijs": "^1.17.0",
"vue": "~2.0.1",
"vue-resource": "^1.2.0",
"vue-router": "^2.2.1",
"vue-truncate-filter": "^1.1.6",
"vuejs-datepicker": "^0.6.2"
},
"devDependencies": {
"browser-sync": "^2.18.8",
"browser-sync-webpack-plugin": "^1.1.4"
}
}
Run Code Online (Sandbox Code Playgroud)
我尝试了以下(在不同时间,不按顺序):
node_modules和npm installyarn和yarn upgradevue-loader并重新安装Jos*_*eie 19
对于vue ^2.5.17.
在你的 package.json
只需添加此内容devDependencies或更新以下版本vue-template-compiler:
"vue-template-compiler": "^2.5.17"你会得到这个输出:
"devDependencies": {
...
"lodash": "^4.17.4",
"popper.js": "^1.14.4",
"vue": "^2.5.17", // <= note the version
"vue-template-compiler": "^2.5.17" // <= note the version
},
Run Code Online (Sandbox Code Playgroud)
之后,运行:
Npm将仅更新更新的包.
小智 18
这对我有用:
修改package.json:
“vue”: “^2.0.8",
“vue-template-compiler”: “^2.1.8"
Run Code Online (Sandbox Code Playgroud)删除 node_modules
npm install不需要删除所有node_modules文件夹。只要更新包:vue,vue-template-compiler并vue-server-renderer通过@latest标记,它应该帮助与VUE包dismatched版本的任何情况。
npm i vue-template-compiler@latest --save
npm i vue-server-renderer@latest --save
--save会自动更新package.json文件中的版本。@latest表示安装软件包的最新可用版本。如果您需要更新,vue请像上面示例中一样进行更新。
此外,您还可以随时检查通过命令更新的新版本:npm outdated。它显示了所有应该更新的软件包列表。
顺便说一句,npm update命令仅更新次要版本和修补程序版本,但是在您要更新主要版本时不可用。例如npm update将不会更新2.4.5=> 3.0.1,但是可以更新
在这里,vue 模板编译器编译 vue 模板。如果你使用 vue 一个版本而 vue-template-compiler 另一个版本,那就是一个问题。
运行这个命令
npm update vue-template-compiler
Run Code Online (Sandbox Code Playgroud)
这将解决这个问题,它会安装一个与 vue js 版本相同版本的 vue 模板编译器。
运行以下命令对我有帮助
npm install vue-template-compiler@2.5.16 --save-dev
注意 用所需的正确版本替换版本号。在我的情况下,vue的版本为2.5.16,vue-template-compiler为2.5.13,因此我将vue-template-compiler更新为vue的版本。
希望这可以帮助某人
更新 Vue 是我的解决方案。
npm i vue@latest --save
Run Code Online (Sandbox Code Playgroud)
想提一下,之前我执行了Kamil' Ocean回答中描述的步骤:
npm i vue-template-compiler@latest --save
npm i vue-server-renderer@latest --save
Run Code Online (Sandbox Code Playgroud)
更新 Vue 后,它就起作用了。
小智 6
这些步骤帮助了我:
rm package-lock.json, rm -rf node_modules, npm update, npm install
Run Code Online (Sandbox Code Playgroud)
小智 6
这对我和你的 100% 有用:
检查依赖关系vue并替换为精确的开发依赖关系vue-template-compiler。
例如。
"dependencies": {
"vue": "^2.5.2",
},
"devDependencies": {
"vue-template-compiler": "^2.5.3",
},
Run Code Online (Sandbox Code Playgroud)
应替换为:
"dependencies": {
"vue": "2.5.2",
},
"devDependencies": {
"vue-template-compiler": "2.5.2",
},
Run Code Online (Sandbox Code Playgroud)
并npm install再次运行。
| 归档时间: |
|
| 查看次数: |
23821 次 |
| 最近记录: |