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
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?
|
gouravkhator commentedJan 24, 2022
•
edited
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.jsrelies 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.tsfile 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.jsfile:Pasting some parts of
../node_modules/electron-fetch/lib/index.es.jsfile, 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
{ "private": true, "name": "client", "version": "0.0.0", "license": "MIT", "scripts": { "build": "preact build", "serve": "sirv build --port 3000 --cors --single", "dev": "preact watch", "lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'", "test": "jest ./tests" }, "eslintConfig": { "parser": "@typescript-eslint/parser", "extends": [ "preact", "plugin:@typescript-eslint/recommended" ], "ignorePatterns": [ "build/" ] }, "dependencies": { "ipfs-core": "^0.13.0", "preact": "^10.3.1", "preact-render-to-string": "^5.1.4", "preact-router": "^3.2.1" }, "devDependencies": { "@types/enzyme": "^3.10.5", "@types/jest": "^26.0.8", "@typescript-eslint/eslint-plugin": "^2.25.0", "@typescript-eslint/parser": "^2.25.0", "enzyme": "^3.11.0", "enzyme-adapter-preact-pure": "^3.1.0", "eslint": "^6.8.0", "eslint-config-preact": "^1.1.1", "jest": "^27.2.5", "jest-preset-preact": "^4.0.2", "preact-cli": "^3.0.0", "sirv-cli": "^1.0.0-next.3", "typescript": "^4.5.2" }, "jest": { "preset": "jest-preset-preact", "setupFiles": [ "<rootDir>/tests/__mocks__/browserMocks.ts", "<rootDir>/tests/__mocks__/setupTests.ts" ] }, "browserslist": { "production": [ "chrome >= 67", "edge >= 79", "firefox >= 68", "opera >= 54", "safari >= 14" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } }Output of
process.versionswhen 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: