electron-vue创建项目提示 /node_modules/_electron-localshortcut@3.2相关错误解决方案
由于electron-localshortcut最近有升级,electron-vue创建好项目后使用的是最新的electron-localshortcut@3.2版本。 electron-localshortcut@3.2版本有一些bug,导致 electron-vue创建项目运行后 提示 /node_modules/_electron-localshortcut@3.2相关错误 错误详情见下:
SyntaxError: Unexpected token {
at Object../node_modules/_electron-localshortcut@3.2.0[@electron-localshortcut](/user/electron-localshortcut)/index.js (D:\electron\vetest01\dist\electron\main.js:293:1)
at __webpack_require__ (D:\electron\vetest01\dist\electron\main.js:21:30)
at eval (webpack:///./node_modules/_electron-debug@1.5.0@electron-debug/index.js?:3:23)
at Object../node_modules/_electron-debug@1.5.0@electron-debug/index.js (D:\electron\vetest01\dist\electron\main.js:221:1)
at __webpack_require__ (D:\electron\vetest01\dist\electron\main.js:21:30)
at eval (webpack:///./src/main/index.dev.js?:2:1)
at Object../src/main/index.dev.js (D:\electron\vetest01\dist\electron\main.js:517:1)
at __webpack_require__ (D:\electron\vetest01\dist\electron\main.js:21:30)
at eval (webpack:///multi_./src/main/index.dev.js_./src/main/index.js?:1:1)
at Object.0 (D:\electron\vetest01\dist\electron\main.js:540:1)
解决方案:
1、在node_modules目录搜索electron-localshortcut 然后删掉 _electron-localshortcut@3.2.0@electron-localshortcut这个文件夹
2、控制台执行 cnpm install electron-localshortcut@3.1.0 --save
3、重新运行 npm run dev