-
Notifications
You must be signed in to change notification settings - Fork 922
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
Pkg loading wrong runtime.js #734
Comments
Hmm. Does adding an explicit If not, this may essentially be a bug in the bundler you're using to package the exe. |
Yep added After doing some digging it seems even adding |
Hmm. We don't have official support for bundling with It's possible that this will get better in our next major version, once #402 lands. Until then, I'm going to close this, but if |
I have exactly same error did you find any solution ? 🥹 |
Please open an issue with |
Hello, For those who have the issue, it can fixed with few Example for Node.js via "pkg": {
"patches": {
"./node_modules/openai/_shims/index.js": [
"require('openai/_shims/auto/runtime')",
"require('openai/_shims/node-runtime')"
]
}
} Openai lib loads runtime dependencies depending on the environment, so using dynamic import paths, and pkg does not like that. The solution is to transform those dynamic imports into static ones depending on the your target environment. |
Confirm this is a Node library issue and not an underlying OpenAI API issue
Describe the bug
Hi all,
We're currently building an application which uses Open AI Node which we go from MJS to JS files using babel. However whenever we try to load application locally ex:
node .\app.js
it runs fine. Once we package the files into an exe is where we run into issues. Mostly not finding the right modules. In this case, it's trying to find _shim/auto/runtime-node.js and cannot find it.I viewed the debug for pkg and it seems like runtime.js is being added
> [debug] Bytecode of C:\Users\ptran\Desktop\nodeServiceTesting\node_modules\openai\_shims\auto\runtime.js is added to queue. It was required from C:\Users\ptran\Desktop\nodeServiceTesting\node_modules\openai\_shims\index.js
Where when we run the actual exe it looking for
runtime-node.js
Here is the error from the executable:
The text was updated successfully, but these errors were encountered: