Closed silver-mx closed 1 year ago
RunJS doesn't use the global NPM config because the settings can potentially cause unpredictable problems, such as overriding the install location. There currently isn't a way to configure proxy settings for NPM in RunJS, but I will consider how this could be implemented in a future release.
@lukehaas I see the debug logs that the NPM search expects an argument like --userconfig=\"\"
. Is there any undocumented way (even if it is a bit hacky) like adding a configuration somewhere that could make this work?
No, this is hard-coded. Without this argument being set, NPM would attempt to use the global config.
I have to use NODE_EXTRA_CA_CERTS
for my command line installs due to corporate web proxy having a self-signed cert. It would be amazing to be able to specify that as well.
@silver-mx I've just pushed a pre-release version of RunJS that will pick up a .npmrc
file if it's located inside the app data directory for RunJS. On Mac, this is here: ~/Library/Application\ Support/runjs
The pre-release is here: https://github.com/lukehaas/RunJS/releases/tag/v2.8.0 It would be great if you could try it out and let me know if it solves this issue for you.
Thanks @lukehaas, I tested the released version today and the search worked fine, but then the installation of the NPM package failed. I tried with rxjs for example, and the logs showed the following error when the installation failed:
NOTE: I included the .npmrc file in the folder C:\Users\myuser\AppData\Local\Programs\runjs
. The .npmrc includes proxy
and https_proxy
.
"[2023-03-13 08:57:29.473] [error] [renderer] Error: Command failed: \"C:\\Users\\myuser\\AppData\\Local\\Programs\\runjs\\RunJS.exe\" \"C:\\Users\\myuser\\AppData\\Local\\Programs\\runjs\\resources\\app.asar.unpacked\\node_modules\\npm\\bin\\npm-cli.js\" install -S --save-exact --ignore-scripts --force --progress=false --audit=false --userconfig=\"C:\\Users\\myuser\\AppData\\Roaming\\runjs\\.npmrc\" rxjs@7.8.0\nnpm WARN using --force Recommended protections disabled.\nnpm ERR! code ENOTFOUND\nnpm ERR! syscall getaddrinfo\nnpm ERR! errno ENOTFOUND\nnpm ERR! network request to https://registry.npmjs.org/rxjs failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org\nnpm ERR! network This is a problem related to network connectivity.\nnpm ERR! network In most cases you are behind a proxy or have bad network settings.\nnpm ERR! network \nnpm ERR! network If you are behind a proxy, please make sure that the\nnpm ERR! network 'proxy' config is set properly. See: 'npm help config'\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! C:\\Users\\myuser\\npm-cache\\_logs\\2023-03-13T07_56_19_055Z-debug-0.log\n\n at __node_internal_genericNodeError (node:internal/errors:856:15)\n at ChildProcess.exithandler (node:child_process:409:12)\n at ChildProcess.emit (node:events:513:28)\n at maybeClose (node:internal/child_process:1093:16)\n at ChildProcess._handle.onexit (node:internal/child_process:302:5)",
@silver-mx thanks for the update. Are you able to successfully install NPM packages via the terminal?
Good news. It works! The only issue was that the .npmrc
with the proxy
/https_proxy
(I have both) configurations must be placed in the location:
C:\Users\myuser\AppData\Roaming\runjs\.npmrc
Previously I had it in C:\Users\myuser\AppData\Local\Programs\runjs\.npmrc
and strangely, the search was working but not the installation. I checked the debug logs and it clearly tries to use the one in C:\Users\myuser\AppData\Roaming\runjs\.npmrc
.
Closing the ticket, thanks for the help and the great work with RunJS 👍
I am behind a proxy and RunJs cannot reach the NPM repository. I checked the documentation but could not find how to set up the proxy settings.
It seems that RunJs uses a special npm client and it is not taking the global NPM configuration. How should I do the configuration then?
See the debug logs: