Search code examples
javascriptnode.jsmusic21

Using music21j in node js, not in browser


I'm attempting to run music21j in node js ( repo link , npm link ).

I get ReferenceError: self is not defined

When trying to simply initialize music21j:

const music21 = require('music21j');
const n = new music21.note.Note('F#');

Does this mean it's not possible to run outside of the browser, or am I somehow initializing to the wrong environment?

The github documentation states

...or use it in your javascript/typescript project

, hence my confusion.


Solution

  • From the github repo:

    At present it's not possible to run outside of the browser. :-( But we're working on removing certain JQuery patches that should make it easier to do. You may however need to use ES6-style imports.