Skip to content
This repository was archived by the owner on Oct 9, 2020. It is now read-only.
This repository was archived by the owner on Oct 9, 2020. It is now read-only.

Node binary is not found (using Electron) #2

Open
@giokara

Description

@giokara

Hi,

It is not clear to me how exactly to use this package from the README. I have a "back-addon" module installed in the node_modules directory (using node-gyp). How should this package be declared in the systemjs configuration file in order to be able to use require(back-addon) in javascript?

For all clarity, I am using Electron, but I don't see how this makes a difference.

For the moment I have tried this (binary is node_modules/back-addon/back-addon.node):

System.config({
  defaultJSExtensions: false,
  paths: {
    'npm:': 'node_modules/'
  },
  map: {
    'node-binary': 'npm:systemjs-plugin-node-binary/node-binary.js',
    'back-addon': 'npm:back-addon'
  },
  packages: {
  'back-addon': {
      main: './back-addon.node',
      meta: {
          '*.node': {
              loader: 'node-binary'
          }
      }
    }
  }
});

This gives the following error:

Error: Error: Node binary file http://localhost:3000/node_modules/back-addon/back-addon.node does not exist.
	at http://localhost:3000/node_modules/systemjs-plugin-node-binary/node-binary.js:21:16
	at FSReqWrap.cb [as oncomplete] (fs.js:260:19)
    Error loading http://localhost:3000/node_modules/back-addon/back-addon.node as "back-addon" from http://localhost:3000/app/front/app/services/back/back.service.js
(anonymous) @ (index):18
ZoneDelegate.invoke @ zone.js:392
Zone.run @ zone.js:142
(anonymous) @ zone.js:844
ZoneDelegate.invokeTask @ zone.js:425
Zone.runTask @ zone.js:192
drainMicroTaskQueue @ zone.js:602

Removing the "main" property in packages (i.e. what is described in the README) gives the following error:

GET http://localhost:3000/node_modules/back-addon/ 404 (Not Found)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions