Frontend

'installVueDevtools' is defined but never used 오류 해결법

samsaraA 2020. 2. 3. 17:46

'installVueDevtools' is defined but never used 오류

vue cli 3.0 이상으로 electron + vue 환경 구축 시 다음과 같은 과정을 따르게된다.

vue create myProject
cd myProject
vue add electron-builder

이 과정에서 Electron 6.0을 선택하면 오류가 발생한다.

error: 'installVueDevtools' is defined but never used 

오류 발생 이유

vue-devtools 모듈이 electron 6.0 버전에서 이슈가 있는 모양이다.
이럴 경우 주석처리 된 코드를 해제하고 electron 버전을 변경해주면 해결된다.
이슈 관련 링크

오류 해결법

주석 해제

src/backgroud.js

app.on('ready', async () => {
  if (isDevelopment && !process.env.IS_TEST) {
    // Install Vue Devtools
    // Devtools extensions are broken in Electron 6.0.0 and greater
    // See https://github.com/nklayman/vue-cli-plugin-electron-builder/issues/378 for more info
    // Electron will not launch with Devtools extensions installed on Windows 10 with dark mode
    // If you are not using Windows 10 dark mode, you may uncomment these lines
    // In addition, if the linked issue is closed, you can upgrade electron and uncomment these lines
    try { //try ~ catch 부분 해제
      await installVueDevtools()
    } catch (e) {
      console.error('Vue Devtools failed to install:', e.toString())
    }
  }
  createWindow()
})

electron 버전 업그레이드

package.json

"devDependencies": {
  ...
  "electron": "^7.1.3",
  ...
},

이후 다시

npm i
vue add electron-builder

해주면 정상적으로 동작한다.