ipfs / ipfs-desktop

An unobtrusive and user-friendly desktop application for IPFS on Windows, Mac and Linux.
https://docs.ipfs.tech/install/ipfs-desktop/
MIT License
5.93k stars 855 forks source link

Unable to build on Linux w/ Node 20. #2637

Closed MichaelJCole closed 11 months ago

MichaelJCole commented 11 months ago

Describe the bug Does not build from source.

To Reproduce Follow instructions from home page

git clone https://github.com/ipfs/ipfs-desktop.git
cd ipfs-desktop
npm ci
npm run build    <-- error here
npm start

Expected behavior Build and install from source

Additional context

It does not build and appears to be downloading a file unexpectedly from IPFS, which is weird because it didn't ask permission to download some unknown data into the build process.

First impressions: It makes me think either the codebase is 1) proprietary 2) malicious or 3) trying to be clever but not working. It's kind of weird this data isn't checked into github, or not part of ipfs-desktop's initialization process.

Anyways, here is the log output...

michael@compy ~/ipfs-desktop                                                                     [18:48:18]
> $ npm run build                                                                           ⬡ 20.6.1 [±main ✓]

> ipfs-desktop@0.30.2 build
> run-s clean build:webui

> ipfs-desktop@0.30.2 clean
> shx rm -rf node_modules/kubo/bin

> ipfs-desktop@0.30.2 build:webui
> run-s build:webui:*

> ipfs-desktop@0.30.2 build:webui:download
> npx ipfs-or-gateway -c bafybeiamycmd52xvg6k3nzr6z3n33de6a2teyhquhj4kspdtnvetnkrfim -p assets/webui/ -t 360000 --verbose -g "https://dweb.link"

✖ Could not fetch via IPFS.
✖ Could not fetch via IPFS HTTP gateway (attempt 1).
✖ Could not fetch via IPFS HTTP gateway (attempt 2).
✖ Could not fetch via IPFS HTTP gateway (attempt 3).
Error: Unexpected status: 504
ERROR: "build:webui:download" exited with 1.
ERROR: "build:webui" exited with 1.

michael@compy ~/ipfs-desktop           

I ran it again and didn't get an error.

> ipfs-desktop@0.30.2 build:webui:download
> npx ipfs-or-gateway -c bafybeiamycmd52xvg6k3nzr6z3n33de6a2teyhquhj4kspdtnvetnkrfim -p assets/webui/ -t 360000 --verbose -g "https://dweb.link"

But npm start loads to white screen and thess error in the terminal:

2023-09-23T00:02:17.221Z info: [web ui] loading STARTED
2023-09-23T00:02:17.275Z error: [web ui] loading undefined
(node:28532) electron: Failed to load URL: webui://-/?deviceId=749ba66a-ce00-4050-b8a7-851f51d0d8c8&lng=#/blank with error: ERR_FILE_NOT_FOUND
(Use `electron --trace-warnings ...` to show where the warning was created)
2023-09-23T00:02:17.342Z info: [App] startup time - 0.9750614419998601 seconds
...
2023-09-23T00:02:18.017Z info: [daemon] PeerID:    12D3KooWLvATkZBc8CgLvvCajTmT3J9LTbNWmXW3D2yZDvXd2hfd
2023-09-23T00:02:18.019Z info: [ipfsd] start daemon FINISHED 1.04766927199997s
...
2023-09-23T00:02:18.047Z info: [ctx] getting webui
2023-09-23T00:02:18.047Z info: [ctx] Found existing property webui
2023-09-23T00:02:18.047Z info: [ctx] Resolving promise for webui
(node:28532) electron: Failed to load URL: webui://-/?deviceId=749ba66a-ce00-4050-b8a7-851f51d0d8c8&lng=&api=%2Fip4%2F127.0.0.1%2Ftcp%2F5001#/blank with error: ERR_FILE_NOT_FOUND
2023-09-23T00:02:18.349Z info: [web ui] navigate to /
(node:28532) electron: Failed to load URL: webui://-/?deviceId=749ba66a-ce00-4050-b8a7-851f51d0d8c8&lng=&api=%2Fip4%2F127.0.0.1%2Ftcp%2F5001#/ with error: ERR_FILE_NOT_FOUND
2023-09-23T00:04:44.846Z info: [web ui] window hidden

And lastly, just a couple warnings in the electron console (no errors):

Electron Security Warning (Insecure Content-Security-Policy) This renderer process has either no Content Security
  Policy set or a policy with "unsafe-eval" enabled. This exposes users of
  this app to unnecessary security risks.

For more information and help, consult
https://electronjs.org/docs/tutorial/security.
This warning will not show up
once the app is packaged.

Is there a missing step?

welcome[bot] commented 11 months ago

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review. In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment. Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

Finally, remember to use https://discuss.ipfs.io if you just need general support.

whizzzkid commented 11 months ago

Thanks for submitting this issue @MichaelJCole the step that fails for you is the ui for ipfs-desktop. ipfs-desktop in itself is a simple container that makes sure kubo and webui can work together in a standalone fashion and has access to other os-specfic features like tray and contextual integrations.

There are multiple ways to access webui:

All of these instances of webui are the same but shipped slightly differently. The file you're seeing being downloaded is the latest release of webui, i.e. v4.1.1 you can match the content identifiers (CID) for both to be bafybeiamycmd52xvg6k3nzr6z3n33de6a2teyhquhj4kspdtnvetnkrfim

I am not 100% sure if that download actually succeeded, can you clean your local build and try again? If you don't have the webui you can reach kubo's built in webui and check the status of your node.

Let me know if you need more support.

MichaelJCole commented 11 months ago

Hi @whizzzkid thanks for taking the time. I wrote this up in a PR for the readme.