1.打开日志文件看看报错原因:C:\Users\Administrator\.IntelliJIdea2018.2\system\log
2.打开idea.log,发现最新的报错如下:
2020-09-07 09:43:16,693 [ 315162] WARN - mponents.impl.stores.StoreUtil - Save settings failed java.lang.RuntimeException: java.lang.Exception: Cannot get TyporaSetting component state at com.intellij.util.ExceptionUtil.rethrow(ExceptionUtil.java:160) at com.intellij.util.lang.CompoundRuntimeException.throwIfNotEmpty(CompoundRuntimeException.java:153) at com.intellij.configurationStore.ComponentStoreImpl.save(ComponentStoreImpl.kt:149) at com.intellij.openapi.components.impl.stores.StoreUtil.save(StoreUtil.java:40) at com.intellij.openapi.application.impl.ApplicationImpl.saveSettings(ApplicationImpl.java:1432) at com.intellij.openapi.components.impl.stores.StoreUtil.saveProjectsAndApp(StoreUtil.java:120) at com.intellij.openapi.components.impl.stores.StoreUtil.saveDocumentsAndProjectsAndApp(StoreUtil.java:113) at com.intellij.openapi.application.impl.ApplicationImpl.saveAll(ApplicationImpl.java:1441) at com.intellij.ide.SaveAndSyncHandlerImpl.saveProjectsAndDocuments(SaveAndSyncHandlerImpl.java:126) at com.intellij.ide.SaveAndSyncHandlerImpl$2.lambda$onFrameDeactivated$0(SaveAndSyncHandlerImpl.java:94) at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88) at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:111) at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:120) at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:122) at com.intellij.ide.SaveAndSyncHandlerImpl$2.onFrameDeactivated(SaveAndSyncHandlerImpl.java:92) at com.intellij.ide.FrameStateManagerImpl.fireDeactivationEvent(FrameStateManagerImpl.java:86) at com.intellij.ide.FrameStateManagerImpl.access$500(FrameStateManagerImpl.java:32) at com.intellij.ide.FrameStateManagerImpl$2.lambda$applicationDeactivated$0(FrameStateManagerImpl.java:72) at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:232) at com.intellij.util.Alarm$Request.runSafely(Alarm.java:405) at com.intellij.util.Alarm$Request.access$700(Alarm.java:330) at com.intellij.util.Alarm$Request$1.run(Alarm.java:371) at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:315) at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:447) at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:431) at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:415) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762) at java.awt.EventQueue.access$500(EventQueue.java:98) at java.awt.EventQueue$3.run(EventQueue.java:715) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.awt.EventQueue.dispatchEvent(EventQueue.java:732) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:781) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:722) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) Caused by: java.lang.Exception: Cannot get TyporaSetting component state at com.intellij.configurationStore.ComponentStoreImpl.doSaveComponents(ComponentStoreImpl.kt:202) at com.intellij.configurationStore.ComponentStoreImpl.save(ComponentStoreImpl.kt:134) ... 40 more Caused by: java.lang.NullPointerException: Can not set a null value for an Attribute at org.jdom.Attribute.setValue(Attribute.java:482) at org.jdom.Attribute.<init>(Attribute.java:221) at org.jdom.Attribute.<init>(Attribute.java:244) at org.jdom.Element.setAttribute(Element.java:1302) at com.wuhulala.intellij.plugins.TyporaSetting.getState(TyporaSetting.java:39) at com.wuhulala.intellij.plugins.TyporaSetting.getState(TyporaSetting.java:11) at com.intellij.configurationStore.ComponentStoreImpl.commitComponent(ComponentStoreImpl.kt:249) at com.intellij.configurationStore.ComponentStoreImpl.doSaveComponents(ComponentStoreImpl.kt:198) ... 41 more
3.Cannot get TyporaSetting component state 主要是这句,提醒了我,Typora是前几天安装的MarkDown插件,然后每次保存就报这个错
把这个插件卸载了就不报错了,每个人报错原因都不同,我是因为插件,具体得看看日志