How can I install electronjs on Ubuntu from behind a proxy? - npm

I have tried to install electronjs several times but I have not been able, I am behind a proxy and each attempt has returned the following error
> electron#10.1.5 postinstall /home/dipper/Development/my-electron-app/node_modules/electron
> node install.js
RequestError: getaddrinfo EAI_AGAIN github.com github.com:443
at ClientRequest.request.once.error (/home/dipper/Development/my-electron-app/node_modules/got/source/request-as-event-emitter.js:178:14)
at Object.onceWrapper (events.js:286:20)
at ClientRequest.emit (events.js:203:15)
at ClientRequest.origin.emit.args (/home/dipper/Development/my-electron-app/node_modules/#szmarczak/http-timer/source/index.js:37:11)
at TLSSocket.socketErrorListener (_http_client.js:401:9)
at TLSSocket.emit (events.js:198:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
npm WARN enoent ENOENT: no such file or directory, open '/home/dipper/Development/my-electron-app/package.json'
npm WARN my-electron-app No description
npm WARN my-electron-app No repository field.
npm WARN my-electron-app No README data
npm WARN my-electron-app No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron#10.1.5 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron#10.1.5 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/dipper/.npm/_logs/2020-11-10T17_15_33_463Z-debug.log

Try this command:
npx cross-env ELECTRON_GET_USE_PROXY=true GLOBAL_AGENT_HTTPS_PROXY=<your proxy URL> npm install electron
Check this thread for more information and the original source.

I solved the problem by changing the connected wifi network. I shared the mobile data with my computer and "npm i electron" worked.

Related

Is there any solution to the error I get while trying to install react-devtools?

I just started learning React Native. I completed my first beginner app. When i tried to install react-devtools but i got a problem. I dont know how to fix it.
PS C:\Users\neveractually\my-app> npm install -g react-devtools
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! code 1
npm ERR! path C:\Users\neveractually\AppData\Roaming\npm\node_modules\react-devtools\node_modules\electron
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c C:\Users\NEVERA~1\AppData\Local\Temp\postinstall-6496f28c.cmd
npm ERR! RequestError: connect ETIMEDOUT 185.199.108.133:443
npm ERR! at ClientRequest.<anonymous> (C:\Users\neveractually\AppData\Roaming\npm\node_modules\react-devtools\node_modules\got\source\request-as-event-emitter.js:178:14)
npm ERR! at Object.onceWrapper (node:events:642:26)
npm ERR! at ClientRequest.emit (node:events:539:35)
npm ERR! at ClientRequest.origin.emit (C:\Users\neveractually\AppData\Roaming\npm\node_modules\react-devtools\node_modules\#szmarczak\http-timer\source\index.js:37:11)
npm ERR! at TLSSocket.socketErrorListener (node:_http_client:454:9)
npm ERR! at TLSSocket.emit (node:events:527:28)
npm ERR! at emitErrorNT (node:internal/streams/destroy:157:8)
npm ERR! at emitErrorCloseNT (node:internal/streams/destroy:122:3)
npm ERR! at processTicksAndRejections (node:internal/process/task_queues:83:21)
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\neveractually\AppData\Local\npm-cache\_logs\2022-08-12T13_53_42_676Z-debug-0.log
Finally, i fix it. Although I did not understand the problem specifically, I was able to solve it. And this solve works for me:
npm uninstall -g react-devtools
npm uninstall -g electron
npm install -g --verbose react-devtools

Unable to "npm install"

Please could I ask for help with the following:
I have cloned the Electron starter app like so:
git clone https://github.com/electron/electron-quick-start
And have it running.
I am working from the terminal window is VSCode.
I am using node version 6.13.4
Can type "npm start" and all is good, app runs fine.
Now, I want to use a certain package for working with zip files, so I try the following:
npm install decompress-zip
The result is ultimately an error, here's the output:
PS C:\Work\Electron Apps\electron-quick-start-added-fs-and-zip> npm install decompress-zip
> electron#16.0.5 postinstall C:\Work\Electron Apps\electron-quick-start-added-fs-and-zip\node_modules\electron
> node install.js
RequestError: self signed certificate in certificate chain
at ClientRequest.<anonymous> (C:\Work\Electron Apps\electron-quick-start-added-fs-and-zip\node_modules\got\source\request-as-event-emitter.js:178:14)
at Object.onceWrapper (events.js:428:26)
at ClientRequest.emit (events.js:333:22)
at ClientRequest.origin.emit (C:\Work\Electron Apps\electron-quick-start-added-fs-and-zip\node_modules\#szmarczak\http-timer\source\index.js:37:11)
at TLSSocket.socketErrorListener (_http_client.js:426:9)
at TLSSocket.emit (events.js:321:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
npm WARN rollback Rolling back debug#2.6.9 failed (this is probably harmless): EPERM: operation not permitted, lstat 'C:\Work\Electron Apps\electron-quick-start-added-fs-and-zip\node_modules\extract-zip\node_modules'npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron#16.0.5 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron#16.0.5 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\105043131\AppData\Roaming\npm-cache\_logs\2022-01-05T11_15_47_499Z-debug.log
Now the build is broken. If try again "npm start" then I get:
PS C:\Work\Electron Apps\electron-quick-start-added-fs-and-zip> npm
start
electron-quick-start#1.0.0 start C:\Work\Electron Apps\electron-quick-start-added-fs-and-zip
electron .
internal/modules/cjs/loader.js:984 throw err; ^
Error: Cannot find module 'C:\Work\Electron
Apps\electron-quick-start-added-fs-and-zip\node_modules\electron\cli.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:981:15)
at Function.Module._load (internal/modules/cjs/loader.js:863:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47 { code: 'MODULE_NOT_FOUND', requireStack: [] } npm ERR! code ELIFECYCLE npm
ERR! errno 1 npm ERR! electron-quick-start#1.0.0 start: electron .
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the
electron-quick-start#1.0.0 start script. npm ERR! This is probably not
a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\105043131\AppData\Roaming\npm-cache_logs\2022-01-05T11_18_31_473Z-debug.log
Makes no difference now if I run "npm uninstall decompress-zip", I still get the same error when I try "npm start".
This line from the above caught my eye:
npm ERR! Failed at the electron#16.0.5
If I start completely over an try installing another package instead like so:
npm install yauzl
I get similar errors including the line:
npm ERR! Failed at the electron#16.0.5 postinstall script.
I currently have electron 8.1.1 installed
Could it be that these packages require electron 16?
Or is it something else?
If it is the former, would anyone know of a solution for unzipping a disk file using an older version of electron?
Thanks for any help.
the best way is to update Node.js. Uninstall old version then go to https://nodejs.org/en/download/ and download LTC version

Npm compiler : Cannot read property 'startsWith' of undefined

I did setup https://github.com/vuejs/vue-cli Vue CLI with the webpack template and it works fine.
But when i change something in template file it throws below error.
Kindly help on the below issue,
> Starting dev server...
DONE Compiled successfully in 2703ms 6:00:35 PM
> Listening at http://localhost:8083
WAIT Compiling... 6:01:05 PM
c:\xampp\htdocs\myproject\node_modules\enhanced-resolve\lib\CachedInputFileSy
stem.js:145
if(key.startsWith(what))
^
TypeError: Cannot read property 'startsWith' of undefined
at Storage.purge (c:\xampp\htdocs\myproject\node_modules\enhanced-resolve
\lib\CachedInputFileSystem.js:145:10)
at Storage.purge (c:\xampp\htdocs\myproject\node_modules\enhanced-resolve
\lib\CachedInputFileSystem.js:150:9)
at CachedInputFileSystem.purge (c:\xampp\htdocs\myproject\node_modules\en
hanced-resolve\lib\CachedInputFileSystem.js:259:20)
at EventEmitter.watcher.once (c:\xampp\htdocs\myproject\node_modules\webp
ack\lib\node\NodeWatchFileSystem.js:42:26)
at EventEmitter.g (events.js:291:16)
at emitTwo (events.js:106:13)
at EventEmitter.emit (events.js:191:7)
at EventEmitter._onTimeout (c:\xampp\htdocs\myproject\node_modules\watchp
ack\lib\watchpack.js:142:7)
at ontimeout (timers.js:380:14)
at tryOnTimeout (timers.js:244:5)
at Timer.listOnTimeout (timers.js:214:5)
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x8
6)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
npm ERR! node v6.10.2
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! dktrgo#1.0.0 dev: `node build/dev-server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the dktrgo#1.0.0 dev script 'node build/dev-server.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the dktrgo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node build/dev-server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs dktrgo
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls dktrgo
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! c:\xampp\htdocs\myproject\npm-debug.log
Thank you
I was able to reproduce in v3.4.0, but not in v3.4.1 (which was released about 5 hours later).
To confirm you're on v3.4.0:
npm list enhanced-resolve
Please update enhanced-resolve to v3.4.1:
npm i enhanced-resolve

npm publish to Artifactory not working

I have setup Artifactory according to the instructions given here, http://www.jfrog.com/confluence/display/RTF/Npm+Repositories, but on publishing a package the following is displayed:
npm http PUT http://localhost:8083/artifactory/api/npm/npm-local/UIBase
npm http 400 http://localhost:8083/artifactory/api/npm/npm-local/UIBase
npm ERR! registry error parsing json
npm ERR! publish Failed PUT response 400
npm ERR! SyntaxError: Unexpected token M
npm ERR! Missing attachments with tarball data, aborting upload for: 'UIBase'
npm ERR! at Object.parse (native)
npm ERR! at RegClient.<anonymous> (/usr/share/npm/node_modules/npm-registry-client/lib/request.js:238:23)
npm ERR! at Request.self.callback (/usr/lib/nodejs/request/index.js:148:22)
npm ERR! at Request.EventEmitter.emit (events.js:98:17)
npm ERR! at Request.<anonymous> (/usr/lib/nodejs/request/index.js:896:14)
npm ERR! at Request.EventEmitter.emit (events.js:117:20)
npm ERR! at IncomingMessage.<anonymous> (/usr/lib/nodejs/request/index.js:847:12)
npm ERR! at IncomingMessage.EventEmitter.emit (events.js:117:20)
npm ERR! at _stream_readable.js:920:16
npm ERR! at process._tickCallback (node.js:415:13)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Linux 3.13.0-39-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "publish" "--registry" "http://localhost:8083/artifactory/api/npm/npm-local"
npm ERR! cwd /home/debjit/code/pubmatic/pub-mgmt/ui/UIBase
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! type unexpected_token
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/debjit/code/pubmatic/pub-mgmt/ui/UIBase/npm-debug.log
npm ERR! not ok code 0
The command I have used is:
npm publish --registry http://localhost:8083/artifactory/api/npm/npm-local
Artifactory logs show the following:
2014-11-19 23:15:23,541 [http-bio-8083-exec-2] [WARN ] (o.j.r.n.r.h.NpmLocalRepoHandler:192) - Missing attachments with tarball data, aborting upload for: 'UIBase'
What am I missing?
You should upgrade your npm client and use at least 1.4.3.
The reason is that the publish command has changed and Artifactory supports the newer format.

NPM installation error

I tried installing browserify (npm module).. I got following error-
praful#ubuntu:~/terminalcloud$ npm install -g browserify
npm http GET https://registry.npmjs.org/browserify
npm ERR! Error: failed to fetch from registry: browserify
npm ERR! at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR! at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR! at Request._callback (/usr/share/npm/lib/utils/npm-registry-client /request.js:136:18)
npm ERR! at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
npm ERR! at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
npm ERR! at Request.emit (events.js:88:20)
npm ERR! at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:12)
npm ERR! at ClientRequest.emit (events.js:67:17)
npm ERR! at HTTPParser.onIncoming (http.js:1261:11)
npm ERR! at HTTPParser.onHeadersComplete (http.js:102:31)
npm ERR! You may report this log at:
npm ERR! <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR! reportbug --attach /home/praful/terminalcloud/npm-debug.log npm
npm ERR!
npm ERR! System Linux 3.8.0-29-generic
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "browserify"
npm ERR! cwd /home/praful/terminalcloud
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: browserify
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/praful/terminalcloud/npm-debug.log
npm not ok
I have installed npm package properly. This error occurs for any package that I try installing with npm. What should I do to?
Just wondering, have you tried
npm config set registry http://registry.npmjs.org/
as per this
The probleme comes from the registry you are using, it is using a secure connection with the hyper transfert text protocol, that might screw things up. https://registry.npmjs.org/browserify
you should use a simple registry that is easy fetchable :
sudo npm config set registry http://registry.npmjs.org/