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

Node binary is not found (using Electron) #2

Open
giokara opened this issue Sep 25, 2017 · 2 comments
Open

Node binary is not found (using Electron) #2

giokara opened this issue Sep 25, 2017 · 2 comments

Comments

@giokara
Copy link

giokara commented Sep 25, 2017

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)
@giokara
Copy link
Author

giokara commented Sep 26, 2017

I made an MWE to illustrate the issue here.

@guybedford
Copy link
Member

This plugin won't support loading binary files in the browser.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants