magenta / magenta-js

Magenta.js: Music and Art Generation with Machine Learning in the browser
https://magenta.tensorflow.org
Apache License 2.0
1.96k stars 312 forks source link

unable to import from @magenta/music #625

Open DronHazra opened 2 years ago

DronHazra commented 2 years ago

I'm trying to use Magenta in a Next.js project, but when I try to import anything it gives me the following error:

node_modules/@magenta/music/esm/coconet/coconet_utils.js (4:7) @ eval
ReferenceError: navigator is not defined
null
Screen Shot 2022-04-03 at 5 07 04 PM

I'm importing something like this: import { SoundFontPlayer } from '@magenta/music' in my index.js file—what's the recommended pattern for importing from Magenta? I've previously used import * as mm from @magenta/music/es6, but that gives me the error error - ReferenceError: self is not defined. Any help is appreciated!

5t33 commented 2 years ago

Also getting this error:

const core = require('@magenta/music/node/core');

results in MODULE_NOT_FOUND