electron / get

Download Electron release artifacts
https://npm.im/@electron/get
MIT License
338 stars 106 forks source link

@electron/get suppresses 404 error #125

Closed NaridaL closed 4 years ago

NaridaL commented 4 years ago

After the issues in #124 I abandoned electron-download in favor of setting ELECTRON_MIRROR="https://npm.taobao.org/mirrors/electron/" as described in https://electronjs.org/docs/tutorial/installation#custom-mirrors-and-caches.

After figuring out to also set DEBUG=*, I got the following log...

2019-11-02T20:26:37.230Z @electron/get:index Checking the cache for electron-v7.0.0-win32-x64.zip (https://npm.taobao.org/mirrors/electron/v7.0.0/electron-v7.0.0-win32-x64.zip) 2019-11-02T20:26:47.144Z @electron/get:index Cache miss 2019-11-02T20:26:47.221Z @electron/get:index Downloading https://npm.taobao.org/mirrors/electron/v7.0.0/electron-v7.0.0-win32-x64.zip to C:\Users\aval\AppData\Local\Temp\electron-download-DId6EI\electron-v7.0.0-win32-x64.zip with options: undefined (node:8096) UnhandledPromiseRejectionWarning: Error: EPERM: operation not permitted, lstat 'C:\Users\aval\AppData\Local\Temp\electron-download-DId6EI\electron-v7.0.0-win32-x64.zip' warning.js:27 (node:8096) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) warning.js:27 (node:8096) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. warning.js:27

It took setting a breakpoint on all exceptions, to figure out the underlying issue has nothing to do with permissions, but that the constructed URL is invalid, because https://npm.taobao.org/mirrors/electron/ doesn't include vs in front of the version! This leads to a HTTP 404, but it isn't logged anywhere.

The docs should be improved and something done so that mirrors URLs can be used interchangeably, but in any case, electron/get needs to log HTTP errors.

ivysrono commented 4 years ago

6.x are OK.

vingel commented 4 years ago

When I use 'npm i elelctron@7.1.1' with ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/, it leads to a response code 404 not found error

Here is I how I fix it for temporary:

  1. Edit node_modules/@electron/get/dist/cjs/artifact-utils.js
  2. edit line 39:
var path = mirrorVar('customDir', opts, details.version);
var path = mirrorVar('customDir', opts, details.version.replace(/v\./, '');

then run npm i electron@7.1.1 again.

xland commented 4 years ago

@vingel

I test it just now. This method doesn't help me.

xland commented 4 years ago

How about this issue's progress?

MarshallOfSound commented 4 years ago

I can't reproduce this @NaridaL. I get the appropriate 404 error in console when I test on my machine.

image

deangoku commented 4 years ago

@MarshallOfSound It can only be reproduced on windows

electron-bot commented 4 years ago

:tada: This issue has been resolved in version 1.7.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket: