这两天工作中出现了一些版本冲突的问题,我也是醉了,前后端都是这个类型的问题。可能是由于我是用自己的烂电脑开发的原因,再有,就是两个月没工作了,技术更新换代的快
1.springboot版本和mybatis分页插件版本冲突
这个问题的解决花了我很长时间,原因是我换和springboot版本相匹配的pagehelper包时,我的idea没反应过来,导致导包一直不能成功,我就认为maven抽风了。
出现如下bug:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration': Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:570) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:849) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
原因是springboot版本为2点几,版本较高,而我还是用1.1.0版本的pagehelper包:
后来我导了个1.2.5的pagehelper包才完事。
2.node.js版本太低导致vue项目不能创建
如下bug:
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (XXX)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
之所以版本低是因为这个node安装包是我从菜鸟教程直接下载的,版本4点几真的很老。
3.windows系统的cmd使用新的命令行导致旧命令不能使用
如下bug:
使用npm命令也是同样的问题,我看了网上的解释,但。。。真的没明白
解决方案如下:
打开cmd窗口,右击窗口标题选择属性,勾选启用旧控制台,确定并重启电脑
可能你会问我怎么知道的?灵感
我写这些的原因,是对项目中出现的不该出现的bug作记录,这上面有些图并不是我项目中实际发生的图,因为这些bug改好了,问题也不好复现,不过我出的bug是这些没错了。如果项目过程中还会出现别的版本问题,我会继续编辑该博客。