小程序启动黑屏问题

本人遇到一个特别坑的问题,使用win7系统打开最新版(1.02.2004020)的微信开发工具,出现莫名黑屏。一开始认为是系统问题,重新安装系统后,还是无法打开开发工具,这就很奇怪了,同事的电脑也是win7系统,是可以正常运行的。经过搜索,分析后,终于锁定问题,下面是解决方案。

新建JSON文件

新建一个名为 localstorage_b72da75d79277d2f5f9c30c9177be57e 的json文件。

文件内容如下。

{
  "show": false,
  "currentCategory": "general",
  "compiler": {
    "clusterCompile": false,
    "autoPreview": false,
    "autoRemoteDebug": false
  },
  "general": {
    "openLastModifiedProject": true,
    "autoPreviewType": "mobile",
    "autoRemoteDebugType": "mobile",
    "maxLogLength": 300,
    "enableNewFW": true,
    "enableGPU": false,
    "ignoreUnsafeProxy": false,
    "locale": "zh",
    "defaultWorkspace": "/Users/kunlideng/WeChatProjects"
  },
  "appearance": {
    "theme": "dark",
    "devtoolsTheme": "dark",
    "fontFamily": "SF Mono",
    "fontSize": 12,
    "lineHeight": 20,
    "simulatorAlignment": "left"
  },
  "edit": {
    "tabSize": 2,
    "insertSpaces": true,
    "wrap": "on",
    "minimap": false,
    "gitIgnoreWindowsReturn": true,
    "autoTypingsDetectEnabled": true,
    "alwaysOpenFileInNewTab": false,
    "autoSave": false,
    "autoRefresh": false,
    "saveBeforeCompile": false,
    "saveBeforePreview": false,
    "saveBeforeUpload": false
  },
  "proxy": {
    "proxyType": "SYSTEM",
    "proxyHost": "127.0.0.1",
    "proxyPort": "12639"
  },
  "notification": {
    "bbs": true,
    "sys": true,
    "alarm": true
  },
  "security": {
    "enableServicePort": true,
    "port": 19195
  },
  "geo": {
    "enabled": false,
    "latitude": 39.92,
    "longitude": 116.46,
    "speed": -1,
    "accuracy": 65,
    "altitude": 0,
    "verticalAccuracy": 65,
    "horizontalAccuracy": 65
  },
  "shortcuts": {
    "_editingShortcuts": false,
    "toggleToolbar": {
      "modifiers": ["cmd", "shift"],
      "key": "T"
    },
    "toggleSimulatorWindow": {
      "modifiers": ["cmd", "alt"],
      "key": "S"
    },
    "toggleEditorWindow": {
      "modifiers": ["cmd", "shift"],
      "key": "E"
    },
    "toggleFileTree": {
      "modifiers": ["cmd", "shift"],
      "key": "M"
    },
    "toggleDebugWindow": {
      "key": "I",
      "modifiers": ["cmd", "shift"]
    },
    "rebuild": {
      "key": "B",
      "modifiers": ["cmd"]
    },
    "format": {
      "key": "F",
      "modifiers": ["shift", "alt"]
    },
    "refresh": {
      "key": "R",
      "modifiers": ["cmd"]
    },
    "toggleForegroundBackgroundStatus": {
      "key": "",
      "modifiers": []
    },
    "documentationSearch": {
      "key": "",
      "modifiers": []
    },
    "gotoFile": {
      "key": "P",
      "modifiers": ["cmd"]
    },
    "gotoRecentFile": {
      "key": "E",
      "modifiers": ["cmd"]
    },
    "preview": {
      "key": "P",
      "modifiers": ["shift", "cmd"]
    },
    "upload": {
      "key": "U",
      "modifiers": ["shift", "cmd"]
    }
  },
  "syncTime": 1584263702017
}

移动文件位置

将json文件移动到 ~/AppData/Local/微信开发者工具/User Data/WeappLocalData 文件目录下,重新启动微信开发者工具即可。

注意:~代表C盘用户根目录