-
-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem installing to npm project #655
Comments
This module is primary written for Node.je, I am not sure what it takes to get it up and running client side. |
@raychien192 could you provide a reproduction repository? |
i have the same issue.
i have a pretty new project with some unimportant components and services. after adding musicbrainz-api with thx |
Hey @rome-legacy |
Hey, it would be helpful to note this fact in the readme file. kind regards |
Hello! My set up is actually quite specialized as I am building a React website through AWS Amplify. For now the direction of my development has taken me elsewhere and I'm not using Musicbrainz API as much. I will most likely write my own wrapper JS classes if I do, just to avoid breaking Amplify again. Thanks for your attention into this! Though if you have any tips on how to safely handle npm packages in an environment like mine, it will be much appreciated. Thanks! |
Use git, you can always roll back your dependency configuration Do not backup |
@rome-legacy
Plainly installing all the dependencies could work, but I'm not sure it will. In the end, this is something this package would need to change, so that it can be used in both the NodeJS, as well as the browser context. @Borewit I might be able to look into getting musicbrainz running in the browser on the weekend. It should be possible to update the package without changing any of the API. |
No that is not the case. Originally NPM was acutally setup for Node.js which introduced modulair dependencies. Also the web client envirnment started to use this mechanism, using bundlers like Webpack to convert modules to bundles. Also the browser has API's which are not present on Node.js, so any combination is possible. Certainly not every model works in every environment. This module is primary deisgned to work with Node.js. Looks like @Haschikeks is going to to an attempt to make it browser complient. |
I'm willing to help, somehow. But i do not have much time in the upcoming weeks. But on/off i will be available. Thx @Haschikeks for trying. 👍 |
Just out of curiosity... Why does the library need to be a node.js module? To me it sounds more like a client of an api. Is it the xml conversion that requires it to be a node module? I took a brief look at the code and maybe it would be enough for me, if i extract the data interfaces to my project and make the calls on my own. But i will definitely wait for Haschikeks experiment 😄 Other question: are there any xml schemas for the musicbrainz api? |
It depends on got as the http client, which is written for Node.js. Fundamental difference is that the HTTP API is totally different between your browser environment and Node.js. So it not the case that we module developers have invented these difference. Furthermore I can imagine you may run into connection restrictions from the browser, as will not connect you outside the website scope without Cross-Origin Resource Sharing (CORS). Also the cookie handling is different, you browser should have good session handling in place. In Node.js there is nothing in place, you have rely on third party modules. |
Yeah, i've checked the dependencies and already thought that got the source of my problems is. Thx for clarification. Regarding the cors problem: that should be the case also for serverside clients... Isn't it? If you do the calls from a different server? For me it is important to have the data model so i can store it and (album/artist/song) and access it in a controlled way. |
On server side you can connect wherever you like. Browser code is typically downloaded from a website, hence much more restriction. That why in Node.js you simple access file system, in the browser you cannot. |
i did a quick experimental test by querying the api from my project (localhost) and it did work out just fine:
|
Hey, quick feedback from me.
@rome-legacy if you only use the types, you may be able to use the package on client apps. But that depends on the bundlers ability to detect that you are only using the types Something to note about using this package on the client side: Keep in mind, that people might look into your source code and use your "credentials" for the musicbrainz api. Which could lead to your credentials beging rate limited or worst case even banned. I know that those credentials aren't real credentials, but it is still something to keep in mind. Have a look at their Rate Limiting for more information. |
Hey, sorry for the late response. I've replaced "got" with ky-universal. |
I will get back to this soon @Haschikeks, I have been busy with some other open source projects. |
Hey @raychien192, @rome-legacy, here is some feedback after a discussion with Borewit, which you can have a look at in the pull request. For now we will not be able to support running this package in the browser, we will update the readme file in the next couple of days to reflect that. We are still in the process of finding a solution that works for both environments, browser & node. |
Ok. Kind regards |
Hello!
Please bear with me as I'm fairly new to npm.
I've tried incorporating this project into my npm project through "npm install musicbrainz-api" and followed the readme guide. However, I ran into all kinds of errors - they all seem to relate to Webpack 5.
Some of the errors I'm getting:
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
WARNING in ./node_modules/musicbrainz-api/lib/xml/xml-isrc.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from ...
Uncaught ReferenceError: process is not defined
at ./node_modules/@szmarczak/http-timer/dist/source/index.js
So, at this point, I might resort to uninstalling it and referencing it for my own hand-crafted code - it would be easier that way!
Thanks
The text was updated successfully, but these errors were encountered: