【发布时间】:2018-10-04 20:48:39
【问题描述】:
我正在尝试在默认浏览器上打开电子应用程序(使用 Angular)的链接,但收到以下错误:
Uncaught TypeError: fs.existsSync is not a function
at Object.<anonymous> (vendor.bundle.js:160955)
at Object../node_modules/electron/index.js (vendor.bundle.js:160961)
at __webpack_require__ (inline.bundle.js:55)
at Object../src/app/components/issue/issue.component.ts (main.bundle.js:159)
at __webpack_require__ (inline.bundle.js:55)
at Object../src/app/app.module.ts (main.bundle.js:75)
at __webpack_require__ (inline.bundle.js:55)
at Object../src/main.ts (main.bundle.js:644)
at __webpack_require__ (inline.bundle.js:55)
at Object.0 (main.bundle.js:662)
我的 html 组件上的按钮上有一个“(click)="onNavigate()"” 这就是功能:
import { shell } from 'electron';
...
onNavigate() {
shell.openExternal("http://www.google.com");
}
...
我不知道我做错了什么,希望这里的人可以帮助我:)
【问题讨论】:
-
我试过了,但我还是新手^^