Unable to locate the "electron-fetch" module within the packaged electron application

I am currently in the process of packaging my electron(-forge) (Webpack, React, TS) application that utilizes electron-fetch in the renderer process with:

const fetch = window
.require("electron").remote
.require("electron-fetch").default;

During testing with yarn start, the application functions as expected.

However, upon running the packaged application (via yarn package), an error is encountered:

Uncaught Error: Cannot find module 'electron-fetch'
Require stack:
- path_to_app/resources/app/.webpack/main/index.js

The packaged app works correctly when electron-fetch is excluded from the codebase.

Environment Details: Node v14.17.4, Yarn 1.22.11

Answer №1

It appears that Electron is having trouble reading the electron-fetch binary located in the app.asar file. To resolve this issue, ensure that you exclude the electron-fetch module from being included in the app.asar during production packaging, or consider not encrypting your app as asar. More information on this problem can be found in this GitHub issue: Unable to access a file inside asar package

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the capability of dynamically generating an index in Typescript?

Can you explain why the Typescript compiler successfully compiles this code snippet? type O = { name: string city: string } function returnString(s: string) { return s } let o1: O = { name: "Marc", city: "Paris", [returnString("random")]: ...

Ways to store data in the localStorage directly from a server

I'm facing an issue - how can I store data in localStorage that was received from the server? Should I use localStorage.setItem for this purpose? And how do I handle storing an array in localStorage? Or am I missing something here? import { HttpCli ...

Upgrade to Rxjs 6 and leverage the power of Observable.create(subscriber -> {...}).share() for enhanced functionality!

In the process of updating my Angular 5 app to Angular 6 and transitioning from rxjs 5 to rxjs 6, I am encountering challenges when migrating the following block of code: const myObservable = Observable.create(subscriber => { // do something with t ...

Intercept Axios Responses - Retrieving API Responses for HTTP Statuses that are not in the 200 range

I've set up a custom Axios instance with interceptors for handling responses. As per the Axios documentation, the success interceptor is triggered for 2xx statuses while the error interceptor handles any other status codes. My goal is to show an error ...

Display a free Admob banner within an Ionic 3 application

I have integrated Admob's banner into my Ionic 3 app following the guidelines provided in the Ionic documentation at this link. Below is the code snippet I used for displaying the banner on the homepage: import { Component } from '@angular/core ...

The Rx subject has not been initialized

Within this particular Namespace, I am exporting a Rx subject of the string data type: namespace something.TaskHandling { export const selectedTask$ = new Rx.Subject<String>(); Inside my TaskListComponent class within the something.TaskHandling. ...

``Using backticks to denote HTML syntax - Leveraging Google Charts to create

Has anyone found a way to incorporate HTML in ticks within a Google chart? I am attempting to insert a weather icon from This is my current attempt: const dailyData = new google.visualization.DataTable(); dailyData.addColumn('timeofday' ...

Utilizing Bootstrap dropdowns in an Angular 2 project necessitates the inclusion of Popper

I recently set up an Angular 2 project using angular-cli and decided to incorporate Bootstrap v4 by running the command npm install <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b6d4d9d9c2c5c2c4d7c6f682988698869bd4d3c2d79884"& ...

The specified function for handling NetworkError is currently unavailable

I'm trying to implement a retry mechanism for URL calls in case of network failure using the 'cockatiel' library. Below is the code snippet I have written: import { retry, handleType, ExponentialBackoff} from 'cockatiel'; const ...

Encountered issues while trying to utilize wasm function within Vue framework

When attempting to integrate wasm with Vue, I encountered a frustrating issue where the startQuorum function in my wasm file could not be located. import { Go } from './wasm_exec' import quorumWasmUrl from './lib.wasm' export const sta ...

Building a comprehensive project using Prisma and Next.JS in TypeScript - encountering an issue where the props "Component" and "pageProps" are deemed invalid

I'm currently in the process of developing my very first full-stack application. In this project, I have chosen to use Next.js as my React framework and Prisma as my ORM for handling database access and migrations. Once I established the connection to ...

Object data is not being received by the defaultValue in React Hook Form

I am currently utilizing React Hook Form to facilitate the process of editing/updating data. I retrieve my data from zustand with a value type of any, and then proceed to save it as the defaultValue in React Hook Form. However, when attempting to acquire v ...

What prevents me from employing my nestjs unique decorator within a constructor?

I am looking to develop a personalized decorator that fetches tenant information. This is the current code snippet I have: export type TenantInfo = { token: string id: string } export const TenantInfo = createParamDecorator( (data: unknown, cont ...

Ways to parse the data from a response received from an Axios POST request

After sending the same POST request using a cURL command, the response I receive is: {"allowed":[],"error":null} However, when I incorporate the POST request in my code and print it using either console.log("response: ", resp ...

Combining property values based on a common property in an array of objects using JavaScript

I have a large array filled with various objects structured like: [ { "type": "bananas", "count": 15 }, { "type": "kiwis", "count": 20 }, { "type": "bananas", ...

Troubleshooting a Deployment Problem in Azure timerTrigger Function with Service Bus Integration

I've been developing an Azure Function that utilizes a timer trigger and interacts with Azure Service Bus. Initially, the function deploys successfully when it only contains the timer trigger code. import { app, InvocationContext, Timer } from "@ ...

Formatting numbers in Angular 2 to include a space every three zeros in a money amount

Let's say I have the number 30000 and I want to format it as 30 000. What method should I use to achieve this? Here are more examples: 300000 -> 300 000, 3000000 -> 3 000 000. Just to clarify, this is not about using dots or commas, but rathe ...

You must pass a string, Buffer, ArrayBuffer, or Array as the first argument when using Uint8Array.slice(). A number was received instead

Here is my implementation of the ByteArray class, which extends the Uint8Array class. export class ByteArray extends Uint8Array { ... private _encoded: string; ... constructor(_encoded: string) { super(Buffer.from(_encoded, " ...

Using object URL to set the source of an image is not functioning properly within the electron framework

Currently working on an electron application ("electron": "^5.0.9", running on Windows 10 version 1903) and dealing with a Node.js buffer (Uint8Array) ("node": "v10.6.0") that holds data in the format of "[255, 216, 255, 224, 0, 16,...)" with a MIME type o ...

Encountering an unanticipated DOMException after transitioning to Angular 13

My Angular project is utilizing Bootstrap 4.6.2. One of the components features a table with ngb-accordion, which was functioning properly until I upgraded the project to Angular 13. Upon accessing the page containing the accordion in Angular 13, I encount ...