-
-
Notifications
You must be signed in to change notification settings - Fork 239
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
Application fails when package.json
is absent
#508
Comments
Unfortunately unlike with the deno and web builds, there is no way for the node one to import the json, as it needs to be able to support both commonjs and es modules, but importing json in esmodules has been experimental in node for a long time (and I'm pretty sure it still is). So the choices are:
|
Can't we just default to |
Well if you never plan on reporting any errors to YouTube.js sure, but as the values in the packages.json file are used to generate the error logs, having them is kind of important. And no there is no way to specify those values at build time because the typescript compiler doesn't support that and if we did a find and replace after the build, the source maps would be incorrect. |
This is better than it crashing, though. Also, you always can check the version manually before reporting anything. |
You are expecting too much from people, lots of the issues on this repo are just people copy pasting the error messages and warnings, they don't provide any context whatsoever. Not even the video or channels they were accessing when the issue occurred. I guess that fallback could be added, probably worth printing an error when it does fall back, saying that the node version of YouTube.js is incompatible with bundling. |
Steps to reproduce
My node application is bundled for deployment, therefore there’s no package.json file in the final build.
YouTube.js/src/platform/node.ts
Line 27 in 68df321
This assumes that the file is always present and crashes my app.
Failure Logs
Expected behavior
The library should continue working without package.json, as it doesn’t contain any essential information for it to function. In fact, putting an empty (with just
{}
)package.json
in my home folder fixes the issue. But this is a bad solution. My app isn’t even in the home directory…Current behavior
The library crashes.
Version
Default
Anything else?
No response
Checklist
The text was updated successfully, but these errors were encountered: