Node package fails to load in atom but not in node?


#1

Hi,
I’m trying to load node-wordnet in an atom package.
From a node console, it’s not an issue at all, but in atom I get the following error:

Uncaught TypeError: undefined is not a function
    at Function.from (native)
    at _toConsumableArray (/usr/lib/atom/node_modules/atom-keymap/lib/partial-keyup-matcher.js:6:182)
    at PartialKeyupMatcher.getMatches (/usr/lib/atom/node_modules/atom-keymap/lib/partial-keyup-matcher.js:62:24)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/usr/lib/atom/node_modules/atom-keymap/lib/keymap-manager.js:371:85)
    at WindowEventHandler.handleDocumentKeyEvent (/usr/lib/atom/src/window-event-handler.js:110:34)

I do need to say that node is 10.3.0 and atom’s node is 8.2.1, but given the package is two years old, I thought it shouldn’t make a difference.
Is there any way I can load the package in atom without having to rewrite it?

Many thanks in advance!


Minimal example:
index.js

module.exports = {
    activate: () => {    
        const WordNet = require('node-wordnet');
    }
};

package.json

{
  "name": "wordnet-test",
  "main": "index",
  "version": "0.0.0",
  "activationCommands": {
    "atom-workspace": "wordnet-test:toggle"
  },
  "license": "MIT",
  "engines": {
    "atom": ">=1.0.0 <2.0.0"
  },
  "dependencies": {
    "node-wordnet": "^0.1.12"
  }
}