Skip to content

Error [ERR_MODULE_NOT_FOUND]: Cannot find package imported from app-2.3.0\resources\app.asar\.vite\build\main.js #9

@phamquyetthang

Description

@phamquyetthang

Hi, I am using your template for my project, it is great and saves me a lot of time, thank you so much!.

However, I am facing a problem when running pnpm make and opening the .exe file. The error is as follows:

Image

It cannot find any package imported into the main.ts file. I have spent a lot of time without finding a solution. Hope you can help!

All your configs in vite and ts config files I have not changed anything

*** Main.ts

import path from 'node:path';

import { BrowserWindow, app, ipcMain } from 'electron';
import installExtension, { REACT_DEVELOPER_TOOLS } from 'electron-devtools-installer';
import squirrelStartup from 'electron-squirrel-startup';
import Store from 'electron-store'

import { createAppWindow } from './appWindow';
import { FEATURE_CHANNELS } from './channels/featureChannels';
import { getFileName, speedUpSilences } from './core';

process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true';

/** Handle creating/removing shortcuts on Windows when installing/uninstalling. */
if (squirrelStartup) {
  app.quit();
}

app.whenReady().then(() => {
  installExtension(REACT_DEVELOPER_TOOLS)
    .then((extension) => console.info(`Added Extension:  ${extension.name}`))
    .catch((err) => console.info('An error occurred: ', err));
});

const store = new Store();

app.on('ready', createAppWindow);

app.on('activate', () => {
 
  if (BrowserWindow.getAllWindows().length === 0) {
    createAppWindow();
  }
});

*** forge.config.ts

Image

Metadata

Metadata

Labels

bugSomething isn't workinghelp wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions