vue和vue-server-renderer的版本不一致,导致编译打包异常(This may cause things to work incorrectly)

问题描述:

09:24:52 Vue packages version mismatch:
09:24:52 
09:24:52 - [email protected]
09:24:52 - [email protected]
09:24:52 
09:24:52 This may cause things to work incorrectly. Make sure to use the same version for both.
09:24:52 
09:24:52     at Object.<anonymous> (/var/jenkins_home/pl114567/node_modules/vue-server-renderer/index.js:8:9)
09:24:52     at Module._compile (module.js:652:30)
09:24:52     at Object.Module._extensions..js (module.js:663:10)
09:24:52     at Module.load (module.js:565:32)
09:24:52     at tryModuleLoad (module.js:505:12)
09:24:52     at Function.Module._load (module.js:497:3)
09:24:52     at Module.require (module.js:596:17)
09:24:52     at require (internal/module.js:11:18)
09:24:52     at Object.<anonymous> (/var/jenkins_home/pl114567/node_modules/nuxt/lib/core/renderer.js:8:34)
09:24:52     at Module._compile (module.js:652:30)
09:24:52 npm info lifecycle [email protected]~build:dev: Failed to exec build:dev script
09:24:52 npm ERR! code ELIFECYCLE
09:24:52 npm ERR! errno 1
09:24:52 npm ERR! [email protected] build:dev: `cross-env __ENV=development nuxt build`
09:24:52 npm ERR! Exit status 1
09:24:52 npm ERR! 
09:24:52 npm ERR! Failed at the [email protected] build:dev script.
09:24:52 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
09:24:52 
09:24:52 npm ERR! A complete log of this run can be found in:
09:24:52 npm ERR!     /var/jenkins_home/.npm/_logs/2022-10-15T01_24_52_877Z-debug.log
09:24:52 cp: cannot stat ‘.nuxt’: No such file or directory

解决办法:打包的时候不要提交package-lock.json,同时指定版本号,不要使用 ^来指定版本号,使用下面这种方式:

"vue": "2.6.10",
"vue-server-renderer": "2.6.10",

猜你喜欢

转载自blog.csdn.net/qq_16733389/article/details/127360775
今日推荐