soundcloud / soundcloud-javascript

Official SoundCloud Javascript SDK
http://developers.soundcloud.com/
Other
386 stars 83 forks source link

NPM package version v3.3.1 errors #93

Closed dolfbarr closed 2 years ago

dolfbarr commented 5 years ago

After installing package from NPM getting this error:

internal/modules/cjs/loader.js:582
    throw err;
    ^

Error: Cannot find module './src/api'

v3.3.0 looks workable.

Example file:

import SC from 'soundcloud';

export const loginToSoundCloud = (clientId) => {
  SC.initialize({
    client_id: clientId,
    redirect_uri: `${window.location.protocol}//${window.location.host}/api/callback`,
  });

  return SC.connect()
    .then(
      json => ({ json }),
      error => ({ error }),
    )
    .catch(error => ({ error }));
};
dolfbarr commented 5 years ago

Similar problem #49

biw commented 5 years ago

@dlf42 It's not a long-term fix but if you add the following to your package.json it should fix it:

scripts: {
 "postinstall": "rm -rf node_modules/soundcloud && git clone https://github.com/soundcloud/soundcloud-javascript.git node_modules/soundcloud",
}
dolfbarr commented 2 years ago

Closing the issue due to inactivity.