question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

electron-forge npm run make native modules pah is error

See original GitHub issue

#1339 # Issue Details

  • Electron Forge Version:@electron-forge/cli”: “^6.0.0-beta.39”,
  • Electron Version: 8.1.1
  • Operating System: MacBook Pro (13-inch, 2017, Two Thunderbolt 3 ports)

Expected Behavior

i run cmd as npm run start, it work. but it can not work, when i run cmd as npm run make.
native modules can not find.
I expected it can work when i run npm run make.

Additional Information

i run cm as npm run make, it can make a package.dmg. I install it and open it. It happen error, some messages:

Uncaught Error: Cannot open /Users/qile/git/klive-teacher/teacher-package/src/lib/pdfmanager.node: Error: dlopen(/Users/qile/git/klive-teacher/teacher-package/src/lib/pdfmanager.node, 1): image not found

test

native modules path is error, it is not relative path, it is absolute path in my mac. I do not know how to resolve it.

my electron-forge conifg:

module.exports = {
  "packagerConfig": {
    "packageManager": "npm",
    "icon": "./make/xx",
    "asar": false,
    "overwrite": true,
    "extraResource": ["./src/lib/jar/", "./src/lib/jre/"]
  },
  "makers": [
    {
      "name": "@electron-forge/maker-squirrel",
      "config": {
        "name": "xx"
      }
    },
    {
      "name": "@electron-forge/maker-dmg",
      "platforms": [
        "darwin"
      ],
      "config": {
        "name": "xx",
        "icon": "./make/xx.ico"
      }
    },
    {
      "name": "@electron-forge/maker-deb",
      "config": {}
    },
    {
      "name": "@electron-forge/maker-rpm",
      "config": {}
    }
  ],
  "plugins": [
    [
      "@electron-forge/plugin-webpack",
      {
        "mainConfig": "./webpack.main.config.js",
        "renderer": {
          "config": "./webpack.renderer.config.js",
          "entryPoints": [
            {
              "html": "./src/index.html",
              "js": "./src/renderer.ts",
              "name": "main_window"
            }
          ]
        }
      }
    ]
  ]
};

I look forward to your reply

thanks

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:14

github_iconTop GitHub Comments

4reactions
this-springcommented, Jun 7, 2020

I have the same issue as @this-spring, when creating a “child_process” inside electron-forge with webpack. The proposed node-loader removal @daijinru doesnt work in my case.

It works great in development with npm run start, but after building with npm run make and installng, the child process fails to load the required modules after installed.

Any ideas?

I resolve the problem by dynamically require. requireDynamically by absolutely path. like this:

const PdfAddon = requireDynamically(nodeUrl);
function requireDynamically(path)
{
    path = path.split('\\').join('/'); // Normalize windows slashes
    return eval(`require('${path}');`); // Ensure Webpack does not analyze the require statement
}
3reactions
cesarvarelacommented, Jun 17, 2021

The solution of using externals will break packaging because the modules won’t be copied to the native_modules folder 😕

Read more comments on GitHub >

github_iconTop Results From Across the Web

electron-forge npm run make native modules pah is error #1688
native modules path is error, it is not relative path, it is absolute path in my mac. I do not know how to...
Read more >
1 - Stack Overflow
It looks like that the culprits are the native modules such as 'sqlite3'. When running the command npm run package , I get...
Read more >
Native Node Modules | Electron
This module can automatically determine the version of Electron and handle the manual steps of downloading headers and rebuilding native modules for your...
Read more >
@electron-forge/cli - npm
A complete tool for building modern Electron applications. Latest version: 6.0.4, last published: 19 days ago. Start using ...
Read more >
Electron Forge: Getting Started
Electron Forge is an all-in-one tool for packaging and distributing Electron applications. It combines many single-purpose packages to create a full build ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found