第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么我的 Angular 8 應(yīng)用程序沒有使用 Electron Packager

為什么我的 Angular 8 應(yīng)用程序沒有使用 Electron Packager

寶慕林4294392 2021-09-30 17:06:38
我一直在嘗試使用 Electron 將我的 Angular 8 應(yīng)用程序?qū)С龅阶烂鎽?yīng)用程序。我想出了如何使用 Electron 運行它,但是當(dāng)我決定使用電子打包器時,我遇到了錯誤。我得到的錯誤與找不到“app-root-path”有關(guān)。我正在使用 main.ts 并將其轉(zhuǎn)換為 Electron 使用的 main.js。任何幫助,將不勝感激。主文件import { app, BrowserWindow } from 'electron';import { resolve } from 'app-root-path';// Keep a global reference of the window object, if you don't, the window will// be closed automatically when the JavaScript object is garbage collected.let win: BrowserWindow;function createWindow () {  // Create the browser window.  win = new BrowserWindow({    width: 800,    height: 600,    webPreferences: {      nodeIntegration: true,    },  });  // Load the angular app.  // Make sure that this path targets the index.html of the  // angular application (the distribution).  win.loadFile(resolve('dist/Invoices/index.html'));  // Emitted when the window is closed.  win.on('closed', () => {    // Dereference the window object, usually you would store windows    // in an array if your app supports multi windows, this is the time    // when you should delete the corresponding element.    win = null;  });}// This method will be called when Electron has finished// initialization and is ready to create browser windows.// Some APIs can only be used after this event occurs.app.on('ready', createWindow);// Quit when all windows are closed.app.on('window-all-closed', () => {  // On macOS it is common for applications and their menu bar  // to stay active until the user quits explicitly with Cmd + Q  if (process.platform !== 'darwin') {    app.quit();  }});每當(dāng)我編譯應(yīng)用程序并且 Electron-packager 創(chuàng)建 exe 時,我都會單擊它,但我收到相同的錯誤?!癑avascript錯誤:錯誤:找不到模塊'app-root-path'需要堆棧:/Invoices/Invoices electron app-darwin-x64/Invoices electron app.app/Contents/Resources/app/bin/main.js”唯一我遇到的另一個問題是必須將 tsconfig.json 目標(biāo)設(shè)置為“es5”,然后在嘗試使用 Electron-packager 時遇到了這個問題。
查看完整描述

2 回答

?
30秒到達(dá)戰(zhàn)場

TA貢獻(xiàn)1828條經(jīng)驗 獲得超6個贊

使這對我有用的是首先將啟動電子命令設(shè)置為此

 "start:electron": "ng build --base-href ./ && electron ."

然后在我的 angular.json 中將 OutputPath 設(shè)置為

 "outputPath": "dist"

然后修復(fù)我的“無法加載模塊腳本”的最終錯誤:我在 tsconfig.json 中進(jìn)行了更改

"target": "es2015" to "target": "es5"

這修復(fù)了我的應(yīng)用程序并允許電子正常工作


查看完整回答
反對 回復(fù) 2021-09-30
?
不負(fù)相思意

TA貢獻(xiàn)1777條經(jīng)驗 獲得超10個贊

您是否在 index.html 中設(shè)置了以下內(nèi)容?

<base href="./">

請注意添加 .


查看完整回答
反對 回復(fù) 2021-09-30
  • 2 回答
  • 0 關(guān)注
  • 234 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號