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

Auto-update fails with ENOENT: no such file or directory, rename #7063

Closed
pietrovismara opened this issue Aug 14, 2022 · 8 comments · Fixed by #8378
Closed

Auto-update fails with ENOENT: no such file or directory, rename #7063

pietrovismara opened this issue Aug 14, 2022 · 8 comments · Fixed by #8378
Labels

Comments

@pietrovismara
Copy link

pietrovismara commented Aug 14, 2022

  • Electron-Builder Version: 23.3.2
  • Node Version: 16.14.2
  • Electron Version: Electron 19.0.8
  • Electron Type (current, beta, nightly): current
  • Target: Windows NSIS, MacOS DMG Zip

This is the same exact issue as #3622, which was ignored and then closed.

This is the error I get on macOS:

Error: Error: ENOENT: no such file or directory, rename '/Users/user/Library/Application Support/Caches/@mydesktopapp-updater/pending/temp-MyDesktopApp-0.0.46-mac.zip' -> '/Users/user/Library/Application Support/Caches/@mydesktopapp-updater/pending/MyDesktopApp-0.0.46-mac.zip'

And on Windows:

ENOENT: no such file or directory, rename 'C:\Users\39380\AppData\Local\@mydesktopapp-updater\pending\temp-MyDesktopApp Setup 0.0.46.exe' -> 'C:\Users\39380\AppData\Local\@mydesktopapp-updater\pending\MyDesktopApp Setup 0.0.46.exe'

The error is also non deterministic: retrying to update several times usually works after the 3rd tentative.

I'm using the autoUpdater as follows:

autoUpdater.autoDownload = false;
autoUpdater.autoInstallOnAppQuit = false;

const updateApp = async () => {
    const quit = new Promise<void>((resolve, reject) => {
      const quitAndInstall = () => {
        try {
          autoUpdater.quitAndInstall();
          resolve();
        } catch (e: any) {
          reject(e);
        }
      };
      return setTimeout(quitAndInstall, isMac ? 10000 : 5000);
    });
    try {
      await quit;
    } catch (e: any) {
      console.log(e);
      Sentry.captureException(e);
    }
};

export const checkAppUpdates = async () => {
    return new Promise<string | null>((resolve, reject) => {
      autoUpdater.once('error', (error) => {
        reject(error);
      });

      autoUpdater.once('update-available', async () => {
        console.log('update-available');
        autoUpdater.once('update-downloaded', (info) => {
          console.log('update-downloaded');
          resolve(info.version);
        });
        autoUpdater.downloadUpdate();
      });
      autoUpdater.once('update-not-available', () => {
        console.log('update-not-available');
        resolve(null);
      });
      autoUpdater.checkForUpdates();
    });
};

checkForUpdates()
.then(updateVersion => {
  if (updateVersion) updateApp();
})

@Thomasfds
Copy link

Hi !

Same for me more information here :
#7069 (comment)

@ccorcos
Copy link

ccorcos commented Oct 13, 2022

Hmm. I'm having a similar issue...

[2022-10-12 21:08:44.307] [info]  Checking for update.
[2022-10-12 21:08:44.324] [info]  Found version 0.0.2 (url: HTML Editor-0.0.2-arm64-mac.zip, HTML Editor-0.0.2-mac.zip)
[2022-10-12 21:08:44.324] [info]  Update Available {
  version: '0.0.2',
  files: [
    {
      url: 'HTML Editor-0.0.2-arm64-mac.zip',
      sha512: 'LdoWqiyAbEY54bvEaeXOvOVDtNeD+FBpKj4o/K4mhpE/zC+Gvoi27Ok5b472/JfpP2vPtmrAi8YL43bWAdm8sg==',
      size: 80631449
    },
    {
      url: 'HTML Editor-0.0.2-mac.zip',
      sha512: 'NK4+cF5Wu3QWOCg+Y1oBGLYBt8eJHdHxJplB06EVYQMb42e1MKSa4FgvjUffq2qDq1L/g2KSmq1sW7Xz/TxBSQ==',
      size: 80137014
    }
  ],
  path: 'HTML Editor-0.0.2-arm64-mac.zip',
  sha512: 'LdoWqiyAbEY54bvEaeXOvOVDtNeD+FBpKj4o/K4mhpE/zC+Gvoi27Ok5b472/JfpP2vPtmrAi8YL43bWAdm8sg==',
  releaseDate: '2022-10-13T03:57:12.393Z'
}
[2022-10-12 21:08:44.325] [info]  Downloading update from HTML Editor-0.0.2-arm64-mac.zip, HTML Editor-0.0.2-mac.zip
[2022-10-12 21:08:44.325] [debug] Checking for macOS Rosetta environment
[2022-10-12 21:08:44.394] [info]  Checked for macOS Rosetta environment (isRosetta=false)
[2022-10-12 21:08:44.395] [debug] Checking for arm64 in uname
[2022-10-12 21:08:44.452] [info]  Checked 'uname -a': arm64=true
[2022-10-12 21:08:44.453] [info]  Downloading update from HTML Editor-0.0.2-arm64-mac.zip, HTML Editor-0.0.2-mac.zip
[2022-10-12 21:08:44.453] [debug] Checking for macOS Rosetta environment
[2022-10-12 21:08:44.512] [info]  Checked for macOS Rosetta environment (isRosetta=false)
[2022-10-12 21:08:44.512] [debug] Checking for arm64 in uname
[2022-10-12 21:08:44.570] [info]  Checked 'uname -a': arm64=true
[2022-10-12 21:08:44.571] [debug] updater cache dir: /Users/chet/Library/Application Support/Caches/html-editor-updater
[2022-10-12 21:08:44.571] [debug] updater cache dir: /Users/chet/Library/Application Support/Caches/html-editor-updater
[2022-10-12 21:08:44.882] [info]  Download Progress {
  total: 80631449,
  delta: 80631449,
  transferred: 80631449,
  percent: 100,
  bytesPerSecond: 261790419
}
[2022-10-12 21:08:44.883] [info]  Download Progress {
  total: 80631449,
  delta: 80631449,
  transferred: 80631449,
  percent: 100,
  bytesPerSecond: 261790419
}
[2022-10-12 21:08:44.883] [info]  New version 0.0.2 has been downloaded to /Users/chet/Library/Application Support/Caches/html-editor-updater/pending/HTML Editor-0.0.2-arm64-mac.zip
[2022-10-12 21:08:44.884] [debug] Creating proxy server for native Squirrel.Mac (fileToProxy=http://localhost:1234/HTML%20Editor-0.0.2-arm64-mac.zip)
[2022-10-12 21:08:44.885] [debug] Proxy server for native Squirrel.Mac is created (fileToProxy=http://localhost:1234/HTML%20Editor-0.0.2-arm64-mac.zip)
[2022-10-12 21:08:44.885] [debug] Proxy server for native Squirrel.Mac is starting to listen (fileToProxy=http://localhost:1234/HTML%20Editor-0.0.2-arm64-mac.zip)
[2022-10-12 21:08:44.887] [debug] Proxy server for native Squirrel.Mac is listening (address=http://127.0.0.1:61230, fileToProxy=http://localhost:1234/HTML%20Editor-0.0.2-arm64-mac.zip)
[2022-10-12 21:08:44.888] [info]  Update Downloaded {
  version: '0.0.2',
  files: [
    {
      url: 'HTML Editor-0.0.2-arm64-mac.zip',
      sha512: 'LdoWqiyAbEY54bvEaeXOvOVDtNeD+FBpKj4o/K4mhpE/zC+Gvoi27Ok5b472/JfpP2vPtmrAi8YL43bWAdm8sg==',
      size: 80631449
    },
    {
      url: 'HTML Editor-0.0.2-mac.zip',
      sha512: 'NK4+cF5Wu3QWOCg+Y1oBGLYBt8eJHdHxJplB06EVYQMb42e1MKSa4FgvjUffq2qDq1L/g2KSmq1sW7Xz/TxBSQ==',
      size: 80137014
    }
  ],
  path: 'HTML Editor-0.0.2-arm64-mac.zip',
  sha512: 'LdoWqiyAbEY54bvEaeXOvOVDtNeD+FBpKj4o/K4mhpE/zC+Gvoi27Ok5b472/JfpP2vPtmrAi8YL43bWAdm8sg==',
  releaseDate: '2022-10-13T03:57:12.393Z',
  downloadedFile: '/Users/chet/Library/Application Support/Caches/html-editor-updater/pending/HTML Editor-0.0.2-arm64-mac.zip'
}
[2022-10-12 21:08:44.890] [error] Error: Error: ENOENT: no such file or directory, rename '/Users/chet/Library/Application Support/Caches/html-editor-updater/pending/temp-HTML Editor-0.0.2-arm64-mac.zip' -> '/Users/chet/Library/Application Support/Caches/html-editor-updater/pending/HTML Editor-0.0.2-arm64-mac.zip'
[2022-10-12 21:08:44.894] [info]  / requested
[2022-10-12 21:08:44.896] [info]  /183cf87c455-1ea1.zip requested
[2022-10-12 21:08:44.896] [info]  /183cf87c455-1ea1.zip requested by Squirrel.Mac, pipe /Users/chet/Library/Application Support/Caches/html-editor-updater/pending/HTML Editor-0.0.2-arm64-mac.zip
[2022-10-12 21:08:44.898] [error] Error: Error: Cannot pipe "/Users/chet/Library/Application Support/Caches/html-editor-updater/pending/HTML Editor-0.0.2-arm64-mac.zip": Error: ENOENT: no such file or directory, open '/Users/chet/Library/Application Support/Caches/html-editor-updater/pending/HTML Editor-0.0.2-arm64-mac.zip'
    at ReadStream.<anonymous> (/Applications/HTML Editor.app/Contents/Resources/app.asar/main.js:134:17704)
    at ReadStream.emit (node:events:390:28)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
[2022-10-12 21:08:49.898] [info]  Proxy server for native Squirrel.Mac is closed (fileToProxy=http://localhost:1234/HTML%20Editor-0.0.2-arm64-mac.zip)
[2022-10-12 21:08:49.901] [warn]  Error: The network connection was lost.
[2022-10-12 21:08:49.901] [error] Error: Error: The network connection was lost.

@ccorcos
Copy link

ccorcos commented Oct 13, 2022

I'm noticing that this logs twice even though I'm only calling it once...

autoUpdater.on("checking-for-update", () => {
	console.log("Checking for update.")
})

And then it appears to be downloading everything twice basically...

@lbestftr
Copy link
Contributor

FYI I had a similar symptom appearing in our application, turns out we were initiating checkForUpdates twice on application load, this was causing a bunch of issues with electron-builder which disappeared once we fixed up the double call our end.
Might be worth investigating if you're still stuck.

@andirsun
Copy link

I think this can be closed.

Copy link
Contributor

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Dec 24, 2023
Copy link
Contributor

This issue was closed because it has been stalled for 30 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 24, 2024
@DMiradakis
Copy link

I'm noticing that this logs twice even though I'm only calling it once...

autoUpdater.on("checking-for-update", () => {
	console.log("Checking for update.")
})

And then it appears to be downloading everything twice basically...

Here in 2024 and I can 100% confirm that this was my exact problem. I manually handle downloading the new version with Electron Builder's provided methods, and my code was clashing with the autoUpdater.autodownload boolean flag being set to true. I hard-coded this property to false, and it fixed my problems.

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

Successfully merging a pull request may close this issue.

6 participants