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

npm install,error #330

Closed
xuwuruoshui opened this issue Nov 5, 2019 · 21 comments
Closed

npm install,error #330

xuwuruoshui opened this issue Nov 5, 2019 · 21 comments
Labels

Comments

@xuwuruoshui
Copy link

✔ Installed 1 packages
✔ Linked 81 latest versions
[1/2] scripts.postinstall electron@7.0.1 › @electron/get@1.6.0 › global-agent@2.1.5 › core-js@^3.3.3 run "node postinstall || echo \"ignore\"", root: "/home/xuwuruoshui/workspace/web/electron/electron-quick-start/node_modules/_core-js@3.3.6@core-js"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

[1/2] scripts.postinstall electron@7.0.1 › @electron/get@1.6.0 › global-agent@2.1.5 › core-js@^3.3.3 finished in 128ms
[2/2] scripts.postinstall electron@^7.0.1 run "node install.js", root: "/home/xuwuruoshui/workspace/web/electron/electron-quick-start/node_modules/_electron@7.0.1@electron"
(node:7752) UnhandledPromiseRejectionWarning: HTTPError: Response code 404 (Not Found)
    at EventEmitter.<anonymous> (/home/xuwuruoshui/workspace/web/electron/electron-quick-start/node_modules/_got@9.6.0@got/source/as-stream.js:35:24)
    at EventEmitter.emit (events.js:210:5)
    at module.exports (/home/xuwuruoshui/workspace/web/electron/electron-quick-start/node_modules/_got@9.6.0@got/source/get-response.js:22:10)
    at ClientRequest.handleResponse (/home/xuwuruoshui/workspace/web/electron/electron-quick-start/node_modules/_got@9.6.0@got/source/request-as-event-emitter.js:155:5)
    at Object.onceWrapper (events.js:300:26)
    at ClientRequest.emit (events.js:215:7)
    at ClientRequest.origin.emit (/home/xuwuruoshui/workspace/web/electron/electron-quick-start/node_modules/_@szmarczak_http-timer@1.1.2@@szmarczak/http-timer/source/index.js:37:11)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:583:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:115:17)
    at TLSSocket.socketOnData (_http_client.js:456:22)
(node:7752) 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)
(node:7752) [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.
[2/2] scripts.postinstall electron@^7.0.1 finished in 523ms
✔ Run 2 scripts
Recently updated (since 2019-10-29): 6 packages (detail see file /home/xuwuruoshui/workspace/web/electron/electron-quick-start/node_modules/.recently_updates.txt)
✔ All packages installed (86 packages installed from npm registry, used 12s(network 11s), speed 112.1kB/s, json 82(195.83kB), tarball 1.06MB)

I use npm install, it stops at node install.js
Later I used cnpm, although the installation was successful, but there are many errors, npm start can not be used

@xuwuruoshui
Copy link
Author

The operating system is manjaro linux

@xuwuruoshui
Copy link
Author

I am waiting for npm install to execute, it still throws an exception like the above code.

@zeroyls
Copy link

zeroyls commented Nov 5, 2019

Same with issue #328

Set the environment variables npm_config_electron_mirror="https://npm.taobao.org/mirrors/electron/" and npm_config_electron_custom_dir="7.0.0"(npm_config_electron_custom_dir needs equal to the version, if the version is 7.0.1, please set npm_config_electron_custom_dir="7.0.1") before npm install.

@xuwuruoshui
Copy link
Author

I think using version 6 is the only solution.

Same with issue #328

Set the environment variables npm_config_electron_mirror="https://npm.taobao.org/mirrors/electron/" and npm_config_electron_custom_dir="7.0.0" before npm install.

@zeroyls
Copy link

zeroyls commented Nov 5, 2019

https://electronjs.org/docs/tutorial/installation

You can use environment variables to override the base URL, the path at which to look for Electron binaries, and the binary filename. The url used by electron-download is composed as follows:

url = ELECTRON_MIRROR + ELECTRON_CUSTOM_DIR + '/' + ELECTRON_CUSTOM_FILENAMECopy
For instance, to use the China mirror:

ELECTRON_MIRROR="https://npm.taobao.org/mirrors/electron/"

In old version, the customDir in code is equal to $VERSION if you set custom mirror, so the composed url will be "https://npm.taobao.org/mirrors/electron/5.0.6/electron-v5.0.6-darwin-x64.zip" (such as in macOS and version is 5.0.6). But in new version, the customDir in code is equal to v$VERSION, the composed url will be https://npm.taobao.org/mirrors/electron/v7.0.1/electron-v7.0.1-darwin-x64.zip if you only set ELECTRON_MIRROR, then you will download fail, because the right url is https://npm.taobao.org/mirrors/electron/7.0.1/electron-v7.0.1-darwin-x64.zip (has no v).

@ahojukka5
Copy link

So how this can be compiled. First impressions to electron are not so good if the first copy-paste example is not working out from the box.

@codebytere
Copy link
Member

codebytere commented Dec 6, 2019

@ahojukka5 did you try it yourself? the above issue is specific to those needing a Chinese mirror for firewall issues Electron cannot control. You should not need that workaround.

@ahojukka5
Copy link

Yes, I tried myself. npm install hangs to post-install phase. I'm not in China.

@kymocode
Copy link

kymocode commented Dec 6, 2019

Same issue here. Not in china. Arm6 32bit.
npm cannot find a binary for version 6 on arm. No versions of 7 work for me

@zlrs
Copy link

zlrs commented Dec 17, 2019

Changing electron version to 6.0.0 in package.json solved this problem.

@Hugh1029
Copy link

Same issue here. Not in china. Arm6 32bit.
npm cannot find a binary for version 6 on arm. No versions of 7 work for me

I referred to zeroyls's method and i got it。But i am in china。maybe you can find a mirror and do it。Or,you can download the mirror:https://github.com/electron/electron/releases/download/v7.1.5/electron-v7.1.5-darwin-x64.zip

@zlrs
Copy link

zlrs commented Dec 18, 2019 via email

@vitjf
Copy link

vitjf commented Dec 18, 2019 via email

@uiuco
Copy link

uiuco commented Jan 9, 2020

Same with issue #328

Electron 6.0.0 version is OK
change the pacakge.json,delete node_modules folder and npm install agin

"devDependencies": {
"electron": "^6.0.0"
}

@Zhwt
Copy link

Zhwt commented Feb 4, 2020

@ahojukka5 did you try it yourself? the above issue is specific to those needing a Chinese mirror for firewall issues Electron cannot control. You should not need that workaround.

That problem is not related to Chinese mirror or firewall, it's about electron-download's internal url compose logic.

@bzr2004
Copy link

bzr2004 commented Feb 19, 2020

$cnpm intall
✔ Installed 1 packages
✔ Linked 80 latest versions
[1/2] scripts.postinstall electron@8.0.1 › @electron/get@1.7.6 › global-agent@2.1.8 › core-js@^3.6.4 run "node -e "try{require('./postinstall')}catch(e){}"", root: "/Users/apple/workspace/electron/electron-quick-start/node_modules/_core-js@3.6.4@core-js"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:

https://opencollective.com/core-js
https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

[1/2] scripts.postinstall electron@8.0.1 › @electron/get@1.7.6 › global-agent@2.1.8 › core-js@^3.6.4 finished in 134ms
[2/2] scripts.postinstall electron@^8.0.0 run "node install.js", root: "/Users/apple/workspace/electron/electron-quick-start/node_modules/_electron@8.0.1@electron"
(node:5004) UnhandledPromiseRejectionWarning: HTTPError: Response code 404 (Not Found) for https://cdn.npm.taobao.org/dist/electron/v8.0.1/electron-v8.0.1-darwin-x64.zip
at EventEmitter. (/Users/apple/workspace/electron/electron-quick-start/node_modules/_got@9.6.0@got/source/as-stream.js:35:24)
at EventEmitter.emit (events.js:321:20)
at module.exports (/Users/apple/workspace/electron/electron-quick-start/node_modules/_got@9.6.0@got/source/get-response.js:22:10)
at ClientRequest.handleResponse (/Users/apple/workspace/electron/electron-quick-start/node_modules/got@9.6.0@got/source/request-as-event-emitter.js:155:5)
at Object.onceWrapper (events.js:428:26)
at ClientRequest.emit (events.js:333:22)
at ClientRequest.origin.emit (/Users/apple/workspace/electron/electron-quick-start/node_modules/
@szmarczak_http-timer@1.1.2@@szmarczak/http-timer/source/index.js:37:11)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:603:27)
at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)
at TLSSocket.socketOnData (_http_client.js:476:22)
(node:5004) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:5004) [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.
[2/2] scripts.postinstall electron@^8.0.0 finished in 3s
✔ Run 2 scripts
Recently updated (since 2020-02-12): 1 packages (detail see file /Users/apple/workspace/electron/electron-quick-start/node_modules/.recently_updates.txt)
✔ All packages installed (85 packages installed from npm registry, used 6s(network 3s), speed 72.26kB/s, json 81(214.25kB), tarball 0B)

use" npm start" can't start project
use "electron ."

@urscion
Copy link

urscion commented Feb 21, 2020

The simplest way I found to fix this problem (for me) was to set the following environment variable
ELECTRON_GET_USE_PROXY=<your proxy>

This is documented in electron/get, but it's not exactly obvious/intuitive as I had http/https_proxy set in my environment but it did not use them.

@VishalAkhouri
Copy link

The only electron major version that seem to work for me is "electron": "6.0.0". I have tried "electron": "^7.1.7" and "electron": "^8.0.3".
It seems to infinitely stuck trying to do node install.js (from electron installed package)

> electron@6.0.0 postinstall /Users/XXX/XXX/electron-quick-start/node_modules/electron
> node install.js  

@caob1234
Copy link

caob1234 commented Mar 4, 2020

This is indeed a network issue.I solved this problem by turning off the VPN and switching the network environment.

@tangyefei
Copy link

After use install cnpm and then run cnpm install it works.

@ckerr
Copy link
Member

ckerr commented Oct 18, 2021

Closing this issue based on the previous two comments saying that it's a network issue and the solution is to use workarounds of changing the network environment or using a tool that fetches from another source.

@ckerr ckerr closed this as completed Oct 18, 2021
@ckerr ckerr added the question label Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests