-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Module not found: Error: Can't resolve 'electron' in one of the deps of ipfs-utils #4024
Comments
Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
Finally, remember to use https://discuss.ipfs.io if you just need general support. |
Also note that I have tried following solutions from electron/electron#27961 I think the IPFS team needs to edit their versions of |
Seems like electron-fetch uses node-gyp, and as node-gyp does not work in browsers, it was having issues. That's why process.versions did not have electron property. Thus, I realised that the package might work, when used in a server. So, I created a server and in that server (i.e., nodejs environment), the ipfs-core package works fine. Kindly check on how to enable the node-gyp in browsers. |
IPFS uses
Lastly, |
But why I was getting the issue then, is there some dependency, which is causing the electron environment to be set partially, without setting the Please check my |
Having this same issue when using ipfs-utils in browser |
Looks like a duplicate of #4011 ? |
Why was this issue closed?
|
Version Details
Version: Using ipfs-core npm package version "^0.13.0"
Platform:
Output of
uname -a
:Linux pop-os 5.15.8-76051508-generic #202112141040
163950527820.04~0ede46a-Ubuntu SMP Fri Dec 17 19: x86_64 x86_64 x86_64 GNU/LinuxBrowser tested on: Firefox 95.0.1 (64-bit).
The ipfs-core is needed in a preact application with preact version "^10.3.1"
Subsystem: Not sure
Severity: High
Description:
ipfs-utils/src/fetch.js
relies onelectron-fetch/lib/index.es.js
.So, it gives error as below, when I run
npx preact build
:Side Notes
I have been using ipfs-core npm package in my preact project.
Preact uses webpack to bundle the application. I have not modified the default webpack config, which comes pre-packed in with mentioned preact package.
Steps to reproduce the error:
My code
In the stacktrace mentioned above,
The
./utils/ipfs.util.ts
file is my code.Root cause
After tracing the files from the stacktrace, I found that, there is some issue in
../node_modules/electron-fetch/lib/index.es.js
file:Pasting some parts of
../node_modules/electron-fetch/lib/index.es.js
file, which causes the issue:As the process.versions.electron is not there, the electron variable is not set, which leads to the issue.
My package.json file
Output of
process.versions
when run from my project files:@ipfs Developers, I humbly request you to provide support on this issue. It is impacting my side project and delaying my work.
The text was updated successfully, but these errors were encountered: