一、问题描述
点击红框按钮时,idea终端报错:To specify an editor, sepcify the EDITOR env variable or add "editor" field to your Vue project config.
二、问题分析
我是在devtools官方文档和devtools源码官方Issues两者结合下解决的此问题,去官方查看Issues也是最有效的解决问题的方法之一。
devtools官方文档:https://devtools.vuejs.org/guide/open-in-editor.html
devtools源码官方Issues:https://github.com/vuejs/devtools/issues
三、问题解决
devtools官方文档教程有需要改的地方,可结合devtools源码官方Issues去解决,这里不再赘述(感兴趣的可以自己查看对比),直接附上最终成功的解决办法。
npm install launch-editor-middleware
- Vue CLI在vue.config.js添加
var openInEditor = require('launch-editor-middleware')
和setup (app) { app.use('/__open-in-editor', openInEditor('D:/开发工具/idea/安装路径/IntelliJIDEA2021.3.1/bin/idea64.exe')) }
附图说明:
- 小插曲:之前idea64.exe的路径是有空格的,这样是万万不行的,需要把空格去掉之后才行。