Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

207
Views
Electron Error - Require is not a function

I am using electron to create an application.

The main page has two buttons - Button 1 and Button 2.

On Click of the button, I am redirecting to another Html Page.

<div class = "container">
     <a class="btn btn-success" href="./src/page1.html" role="button">Go to Page 1</a>
</div>
<div class = "container">
     <a class="btn btn-success" href="./src/page2.html" role="button">Go to Page 2</a>
</div>

Then in the Page1.html, I am adding the corresponding JS in script tag.

<script src="page1.js"></script>

However, in the JS file, I am not able to use the require function. Error: Require is not a function.

However, require function works fine in main.js

Please help me in figuring out what am I doing wrong. I have just recently started with Electron.

Any help appreciated.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!