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

[Error] Can't resolve ./build/debug/farmhash.node - Version 3.3.0 #46

Closed
LadyAiss opened this issue Jun 1, 2023 · 3 comments
Closed
Labels

Comments

@LadyAiss
Copy link

LadyAiss commented Jun 1, 2023

Hello,

I am running into the following bug when trying to use farmhash (version 3.3.0) in my project:

ERROR in ./node_modules/farmhash/index.js 7:11-49
Module not found: Error: Can't resolve './build/Debug/farmhash.node' in '.../node_modules/farmhash'
resolve './build/Debug/farmhash.node' in '.../node_modules/farmhash'
  using description file: .../node_modules/farmhash/package.json (relative path: .)
    using description file: .../node_modules/farmhash/package.json (relative path: ./build/Debug/farmhash.node)
      no extension
        .../node_modules/farmhash/build/Debug/farmhash.node doesn't exist
      .tsx
        .../node_modules/farmhash/build/Debug/farmhash.node.tsx doesn't exist
      .ts
        .../node_modules/farmhash/build/Debug/farmhash.node.ts doesn't exist
      .jsx
        .../node_modules/farmhash/build/Debug/farmhash.node.jsx doesn't exist
      .js
       .../node_modules/farmhash/build/Debug/farmhash.node.js doesn't exist
      .vue
        .../node_modules/farmhash/build/Debug/farmhash.node.vue doesn't exist
      as directory
       .../node_modules/farmhash/build/Debug/farmhash.node doesn't exist
webpack 5.76.0 compiled with 1 error in 20638 ms

The error is caused by this following code in index.js

const farmhash = (function farmhashBinding () {
  try {
    return require('./build/Release/farmhash.node');
  } catch (e) {
    return require('./build/Debug/farmhash.node');
  }
}());

because as you can see in the screenshot the referenced file does not exist
CleanShot 2023-06-01 at 11 31 45

I tried installing previous versions instead but then I ran into this issue and none of the solutions mentioned there worked for me.

Help will be highly appreciated, since we are really looking forward to using this package 😃

@lovell
Copy link
Owner

lovell commented Jun 1, 2023

Hi, is farmhash included in your webpack externals configuration?

externals: {
  'farmhash': 'commonjs farmhash'
}

@lovell lovell added the question label Jun 1, 2023
@LadyAiss
Copy link
Author

LadyAiss commented Jun 2, 2023

Hi @lovell,
Thank you for the quick reply,

Yes, I have added it to the externals configuration and that fixes the first error but then I have the same error as mentioned in this issue

ReferenceError: 'require' is not defined

@lovell
Copy link
Owner

lovell commented Jun 2, 2023

Thanks, I'll close this issue and we can continue to track that problem at #44

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

No branches or pull requests

2 participants