Skip to content
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

Return statement error #97

Open
Vitomir2 opened this issue May 28, 2024 · 0 comments
Open

Return statement error #97

Vitomir2 opened this issue May 28, 2024 · 0 comments

Comments

@Vitomir2
Copy link

Vitomir2 commented May 28, 2024

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

So, there was a problem with the require statement of the ecdh package and the return statement. There is no function, so, we have to delete the return statement and just leave the module exports in the index.js.

Here is the diff that solved my problem (keep in mind that the real path is not exposed):

diff --git a/node_modules/eccrypto/index.js b/node_modules/eccrypto/index.js
index a63218b..e6383b4 100644
--- a/node_modules/eccrypto/index.js
+++ b/node_modules/eccrypto/index.js
@@ -15,13 +15,13 @@ var crypto = require("crypto");
 // try to use secp256k1, fallback to browser implementation
 try {
   var secp256k1 = require("secp256k1");
-  var ecdh = require("./build/Release/ecdh");
+  var ecdh = require("ecdh");
 } catch (e) {
   if (process.env.ECCRYPTO_NO_FALLBACK) {
     throw e;
   } else {
     console.info('secp256k1 unavailable, reverting to browser version');
-    return (module.exports = require("./browser"));
+    module.exports = require("./browser");
   }
 }
 

This issue body was partially generated by patch-package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant