Skip to content

Return statement error #97

@Vitomir2

Description

@Vitomir2

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch eccrypto@1.1.6 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions