ipfs / npm-kubo

Install Kubo (go-ipfs) from NPM
https://www.npmjs.com/package/kubo
MIT License
41 stars 30 forks source link

bug: npm-kubo fails to install on windows #68

Closed SgtPooki closed 3 months ago

SgtPooki commented 11 months ago

windows has a history of issues with symlinks. i don't know why this is popping up now, but there are multiple reports of this not working, and I was able to reproduce locally on a windows machine as well.

Kubo Releaser failure

> ./kuboreleaser release --version v0.23.0 update-ipfs-desktop
GPG_KEY is not set. The key should be base64 encoded. Please enter the key:: 
GPG_PASSPHRASE is not set. Please enter a secret value: 
INFO[2023-10-05 18:00:37] Checking the status of the action...         
INFO[2023-10-05 18:00:37] I'm going to check if the PR that updates Kubo in IPFS Desktop has been created already. 
INFO[2023-10-05 18:00:37] The action is not complete yet, continuing... 
WARN[2023-10-05 18:00:37] PR for https://github.com/ipfs/ipfs-desktop/tree/kubo-v0.23.0 not found (the action is not complete) 
INFO[2023-10-05 18:00:37] Running the action...                        
INFO[2023-10-05 18:00:37] I'm going to create a PR that updates Kubo in IPFS Desktop. 
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
npm ERR! code 1
npm ERR! path /tmp/kuboreleaser2456904201/node_modules/kubo
npm ERR! command failed
npm ERR! command sh -c node src/post-install.js
npm ERR! https://dist.ipfs.tech/kubo/versions
npm ERR! Downloading https://dist.ipfs.tech/kubo/v0.23.0/kubo_v0.23.0_linux-amd64.tar.gz to /root/.cache/npm-kubo
npm ERR! Downloaded https://dist.ipfs.tech/kubo/v0.23.0/kubo_v0.23.0_linux-amd64.tar.gz
npm ERR! Downloading kubo_v0.23.0_linux-amd64.tar.gz.sha512
npm ERR! Downloaded kubo_v0.23.0_linux-amd64.tar.gz.sha512
npm ERR! Verifying kubo_v0.23.0_linux-amd64.tar.gz.sha512
npm ERR! OK (1cbfc09f4b6ed13481b4035bce8414824ed019afefc866378daa1f3f1cbf4e91306f8525e600074eaac392b527a53fd9a662406183abdc4bd80bb37dc29a7472)
npm ERR! Unpacked /tmp/kuboreleaser2456904201/node_modules/kubo
npm ERR! Linking /tmp/kuboreleaser2456904201/node_modules/kubo/kubo/ipfs to /tmp/kuboreleaser2456904201/node_modules/kubo/bin/ipfs
npm ERR! Error: ipfs binary failed: Error: spawnSync /tmp/kuboreleaser2456904201/node_modules/kubo/bin/ipfs ENOENT
npm ERR!     at link (/tmp/kuboreleaser2456904201/node_modules/kubo/src/download.js:220:11)
npm ERR!     at module.exports (/tmp/kuboreleaser2456904201/node_modules/kubo/src/download.js:248:10)
npm ERR!     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2023-10-05T18_00_43_346Z-debug-0.log
exit status 1

local npm failure

PS C:\Users\sgtpo\code\work\protocol.ai\ipfs\npm-kubo> npm i
npm WARN deprecated trim@0.0.1: Use String.prototype.trim() instead

> kubo@0.23.0 postinstall
> node src/post-install.js

https://dist.ipfs.tech/kubo/versions
Downloading https://dist.ipfs.tech/kubo/v0.23.0/kubo_v0.23.0_windows-amd64.zip to C:\Users\sgtpo\AppData\Local\npm-kubo\Cache       
Downloaded https://dist.ipfs.tech/kubo/v0.23.0/kubo_v0.23.0_windows-amd64.zip
Downloading kubo_v0.23.0_windows-amd64.zip.sha512
Downloaded kubo_v0.23.0_windows-amd64.zip.sha512
Verifying kubo_v0.23.0_windows-amd64.zip.sha512
OK (3c6c0c6a90012bc37c8afdc380e48bda4b0413218aaccf72fa246e10915c1c2d04ab3e2211fbdede97a0bca75b00f2be0f6ce9e320829b45dcc23f14b93c8a08)
Unpacked C:\Users\sgtpo\code\work\protocol.ai\ipfs\npm-kubo
Linking C:\Users\sgtpo\code\work\protocol.ai\ipfs\npm-kubo\kubo\ipfs.exe to C:\Users\sgtpo\code\work\protocol.ai\ipfs\npm-kubo\bin\ipfs.exe
Error: EPERM: operation not permitted, symlink 'C:\Users\sgtpo\code\work\protocol.ai\ipfs\npm-kubo\kubo\ipfs.exe' -> 'C:\Users\sgtpo\code\work\protocol.ai\ipfs\npm-kubo\bin\ipfs.exe'
    at Object.symlinkSync (node:fs:1816:3)
    at link (C:\Users\sgtpo\code\work\protocol.ai\ipfs\npm-kubo\src\download.js:207:6)
    at module.exports (C:\Users\sgtpo\code\work\protocol.ai\ipfs\npm-kubo\src\download.js:248:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errno: -4048,
  syscall: 'symlink',
  code: 'EPERM',
  path: 'C:\\Users\\sgtpo\\code\\work\\protocol.ai\\ipfs\\npm-kubo\\kubo\\ipfs.exe',
  dest: 'C:\\Users\\sgtpo\\code\\work\\protocol.ai\\ipfs\\npm-kubo\\bin\\ipfs.exe'
}
npm ERR! code 1
npm ERR! path C:\Users\sgtpo\code\work\protocol.ai\ipfs\npm-kubo  
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node src/post-install.js

npm ERR! A complete log of this run can be found in: C:\Users\sgtpo\AppData\Local\npm-cache\_logs\2023-10-06T17_28_19_739Z-debug-0.log
PS C:\Users\sgtpo\code\work\protocol.ai\ipfs\npm-kubo> 

github CI failure

Run npm ci --prefer-offline --no-audit --progress=false --cache D:\a\ipfs-desktop\ipfs-desktop/.cache/npm
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v[8](https://github.com/ipfs/ipfs-desktop/actions/runs/6422809980/job/17471972505#step:9:9).dev/blog/math-random for details.
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 
npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in: D:\a\ipfs-desktop\ipfs-desktop\.cache\npm\_logs\2023-[10](https://github.com/ipfs/ipfs-desktop/actions/runs/6422809980/job/17471972505#step:9:11)-06T[16](https://github.com/ipfs/ipfs-desktop/actions/runs/6422809980/job/17471972505#step:9:17)_04_[21](https://github.com/ipfs/ipfs-desktop/actions/runs/6422809980/job/17471972505#step:9:22)_504Z-debug-0.log

References

SgtPooki commented 11 months ago

@Jorropo @lidel have there been any changes in the kubo distribution (or packaged binary) that would impact installs on windows? The consistent CI failures starting out of nowhere in ipfs-desktop are truly mind-boggling to me. Some things that I was thinking and reasons I no longer think those are the causes:

Template: <#>. <HYPOTHESIS> --- <reason hypothesis is not true, or is unlikely>

  1. github windows CI runner permissions were changed, so symlinks started to fail --- local ipfs-desktop install for my windows machine is also failing (which wasn’t previously the case.. can run git bisect if requested)
  2. windows did a forced update to all windows machines causing symlinks to fail —- I generally do not update my windows desktop because I don’t use it enough anymore.. this is also quite a stretch if you understand how updates are distributed
  3. nodejs did some update that changed how fs.symlinkSync works on windows --- even running the same nodejs versions that have previously passed in ipfs-desktop result in failures
SgtPooki commented 11 months ago

seems to be related to nodejs 18.18.0, see https://github.com/ipfs/ipfs-desktop/pull/2662

Suo-Ran commented 4 months ago

@Jorropo @lidel have there been any changes in the kubo distribution (or packaged binary) that would impact installs on windows? The consistent CI failures starting out of nowhere in ipfs-desktop are truly mind-boggling to me. Some things that I was thinking and reasons I no longer think those are the causes:

Template: <#>. <HYPOTHESIS> --- <reason hypothesis is not true, or is unlikely>

  1. github windows CI runner permissions were changed, so symlinks started to fail --- local ipfs-desktop install for my windows machine is also failing (which wasn’t previously the case.. can run if requested)git bisect
  2. windows did a forced update to all windows machines causing symlinks to fail —- I generally do not update my windows desktop because I don’t use it enough anymore.. this is also quite a stretch if you understand how updates are distributed
  3. nodejs did some update that changed how works on windows --- even running the same nodejs versions that have previously passed in ipfs-desktop result in failuresfs.symlinkSync

This package can only be carried out under the administrator privileges. Could you please resubmit the repair code

lidel commented 3 months ago

Reopening as this is broken in 20.x (confirmed by @aschmahmann) and https://github.com/ipfs/ipfs-desktop/pull/2662 was a workaround to pin to older version without fixing the underlying issue.

lidel commented 3 months ago

The fix from #74 should ship with 0.29.0 next week.

Admin will no longer be necessary: if symlinking fails on Windows, a copy of binary is created instead.