Error when performing the request while installing yarn - reactjs

When I try to install yarn, I've got the following output:
Internal Error: Error when performing the request
at ClientRequest.<anonymous> (C:\Program Files\nodejs\node_modules\corepack\dist\corepack.js:3937:20)
at ClientRequest.emit (node:events:390:28)
at TLSSocket.socketErrorListener (node:_http_client:447:9)
at TLSSocket.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)

TL;DR
Create a custom CA certificate file (in this example c:\temp\combo.ca.cer) containing BASE64-encoded DERs of all certs your corporate network security solution is presenting to Node.js when Node.js makes HTTPS requests
I used advice from https://stackoverflow.com/a/44726189 to create my custom CA cert file
set NODE_EXTRA_CA_CERTS=c:\temp\combo.ca.cer
corepack enable
yarn set version stable
Root Cause Analysis
I had the "Internal Error: Error when performing the request" at "corepack.js:3937:20" like everyone who's been here so I looked in line 3937 and discovered it was a vanilla https.get call. I stuck in some extra debugging into corepack.js to see what was being accessed and discovered it was failing trying to reach "https://registry.npmjs.com/pnpm".
I navigated to "https://registry.npmjs.com/pnpm" in my web browser and discovered my corporate environment let it load up with no errors. So I fired up Node JS and issued to see what would happen:
https.get("https://registry.npmjs.com/pnpm", {}, res => console.log(res));
I received a "unable to get local issuer certificate" error. In my corporate environment, there's a security solution that injects it's own self-signed certificates into responses from any outbound https requests. What that means for me is that I need to instruct anything issuing https requests (eg Node.js and curl) to use a custom CA certificate file.
To get corepack to work, I first hard-coded a custom CA certificate file into corepack.js and while it's pretty ugly, it did work. A bit of further digging around I found the NODE_EXTRA_CA_CERTS environment variable option used by Node.js so also tried the following in a Administrator-privileged cmd session with success (also removing the corepack.js hack I made earlier):
set NODE_EXTRA_CA_CERTS=c:\temp\combo.ca.cer
corepack enable
yarn set version stable
The combo.ca.cer was constructed by navigating to https://registry.npmjs.com/pnpm and exporting all the CA certs (root and any intermediate CA certs) to text files and copy-pasting the contents of all the CA cert files into a single text file called combo.ca.cer. I used advice from https://stackoverflow.com/a/44726189 to create my custom CA cert file.

As part of the initial setup of a work computer, I got this same error. Even a clean run of yarn (yarn init -2 in an empty folder) would cause the error.
Turning off my VPN made yarn work as expected.
Googling the error lead me to this page which got me to suspect the VPN. https://github.com/nodejs/corepack/issues/67

I had the same problem and for me it was solved by running yarn set version stable.

Related

authentication failed due to: self signed certificate in certificate chain error after hitting localhost:3000

I tried giving - npm config set strict-ssl=false
But still I see this error, I have configured my azure environment correctly
tried skipping the tls
go to index.js or app.js and add this line for least option and I hope it will work
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0

Composer 2.5.1 Symfony Ux-React Failed to Download Webpack Encore Pack

I have a Symfony project that uses composer and react. I am trying to download the symfony/ux-react package with composer following this link: https://symfony.com/bundles/ux-react/current/index.html
However, when I run composer require symfony/ux-react I get the following error:
- Downloading symfony/webpack-encore-pack (v1.0.2)
0/1 [>---------------------------] 0% Failed to download symfony/webpack-encore-pack from dist: The "https://api.github.com/repos/symfony/webpack-encore-pack/zipball/f9f4e91659e5f55de370d6aebe77e64bce35e4d3" file could not be downloaded (HTTP/2 404 ):
{"message":"Not Found","documentation_url":"https://docs.github.com/rest/reference/repos#download-a-repository-archive"}
Now trying to download from source
- Syncing symfony/webpack-encore-pack (v1.0.2) into cache
Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos
When working with _public_ GitHub repositories only, head to https://github.com/settings/tokens/new?scopes=&description=Composer+on+lex-Blade-15-Mid-2019-Base+2023-01-27+1205 to retrieve a token.
This token will have read-only permission for public information only.
When you need to access _private_ GitHub repositories as well, go to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+lex-Blade-15-Mid-2019-Base+2023-01-27+1205
Note that such tokens have broad read/write permissions on your behalf, even if not needed by Composer.
Tokens will be stored in plain text in "/home/lex/.config/composer/auth.json" for future use by Composer.
For additional information, check https://getcomposer.org/doc/articles/authentication-for-private-packages.md#github-oauth
Token (hidden):
I then create a token. Upon copy pasting it into the terminal:
Token stored successfully.
1/1 [============================] 100%
In Git.php line 471:
Failed to execute git clone --mirror -- 'https://ghp...PNs:x-oauth-basic#github.com/symfony/webpack-encore-pack.git' '/home/lex/.cache/composer/vcs/https---github.com-symfony-webpack-encore-p
ack.git/'
Cloning into bare repository '/home/lex/.cache/composer/vcs/https---github.com-symfony-webpack-encore-pack.git'...
remote: Repository not found.
fatal: repository 'https://github.com/symfony/webpack-encore-pack.git/' not found
Anyone know a fix for this? It appears that webpack-encore-pack is depreciated.
Spoke too soon. Found this link: https://github.com/symfony/symfony/discussions/42700
By uninstalling webpack encore with composer remove symfony/webpack-encore-pack and then trying composer require symfony/ux-react, no error occurred.

Error: unable to verify the first certificate after setting up an id_rsa

I suddenly faced an error when starting a nextJS app after running the following commands:
ssh-keygen -t rsa -C "myemail#example.com"
After setting up the passphrase I cannot run npm run dev and get the following issue:
{
code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
}
I also tried disabled the ssl on npm but it is still not working
UNABLE_TO_VERIFY_LEAF_SIGNATURE should be an error seen with certificate issue for HTTPS URLs (like here), not SSH.
In other works, your SSH key should not be involved at all.
If you have git+https:// URLs in your dependencies:
either you can fix your certificates (example on Windows)
or you can use, for some URLs, an SSH one instead of HTTPS (which would then rely on your SSH key)

ssl handshake error while deploying google app engine

I am getting the following error while deploying the google app engine
ERROR: gcloud crashed (SSLHandshakeError): [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)
If you would like to report this issue, please run the following command:
gcloud feedback
To check gcloud for common problems, please run the following command:
gcloud info --run-diagnostics
I am using python 2.7 also tried turning off firewall settings but doesnot help. Any suggestions?
This is a common network issue seen when there is a networking proxy present on your network or antivirus and similar software that might prevent the connection.
As you mentioned the issue was solved when deactivating an antivirus software. If you still want to run the antivirus, you can configure it properly to allow the connection to GCP.
I tried this to avoid SSL certificate validation and successfully worked
gcloud config set auth/disable_ssl_validation True

Why Will Protractor Webdriver Update Not Execute?

I am trying to use Protractor on a baseline run of the Angular Quickstart Seed.
However, when I run Protractor, or simply try to update the webdriver myself I get the following output:
[11:31:24] I/file_manager - creating folder C:\Users\davidtaylorjr\devbox\home\angula
r2-fundamentals\node_modules\protractor\node_modules\webdriver-manager\selenium
events.js:161
throw er; // Unhandled 'error' event
^
Error: unable to verify the first certificate
at TLSSocket.<anonymous> (_tls_wrap.js:1085:38)
at emitNone (events.js:86:13)
at TLSSocket.emit (events.js:186:7)
at TLSSocket._finishInit (_tls_wrap.js:603:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:433:38)
I have not modified any of the files and they are the files that are available in the Angular Quickstart
The software is having a conflict with current network settings and SSL Certificate Verification.
Protractor and Web-Driver have a way to deal with this by setting a flag on your update command. The command set should be as follows:
webdriver-manager update --ignore_ssl
This will allow you to update without being flagged with SSL errors.
This should only be used if other methods of working with SSL fails.
Webdriver-manager on update downloads some drivers/jars from the below sources. Looks like there is some issue during this. Can you manually download and verify if you are able to access the below url's
Sources: from webdriver-manager configs
"cdnUrls": {
"selenium": "https://selenium-release.storage.googleapis.com/",
"chromedriver": "https://chromedriver.storage.googleapis.com/",
"geckodriver": "https://github.com/mozilla/geckodriver/releases/download/",
"iedriver": "https://selenium-release.storage.googleapis.com/",
"androidsdk": "http://dl.google.com/android/"
}

Resources