Reputation: 1
Today I tried to update from Angular 17 to Angular 18. I am in a company with a custom proxy for the npm
registry (uses a Nexus Repository for private packages). So we have disabled certificate validation in our npm
config.
I get this error:
(node:12304) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)
× Migration failed: request to https-nexus/@angular%2fcli failed, reason: unable to verify the first certificate
So I tried to get more information about this, and I found some info.
Found several related issues:
According to them, in a version of Angular CLI the problem seems to have been fixed, I've also tried the solutions mentioned, but it doesn't work on my side.
Also found this posts:
But didn't help me, first because they are not Angular related and second because they're too old.
My npm
config:
https-proxy = "proxy"
no_proxy = "nexus"
progress = true
; "env" config from environment
registry = "https-nexus"
strict-ssl = false
unsafe-perm = true
; "cli" config from command line options
global = true
Window user env var:
HTTP_PROXY=proxy
HTTPS_PROXY=proxy
NO_PROXY=localhost,127.0.0.1,.private-proxy
NODE_OPTIONS=--max-http-header-size=200000
NODE_TLS_REJECT_UNAUTHORIZED=0
NPM_CONFIG_REGISTRY=https-nexus
NPM_CONFIG_STRICT_SSL=false
NPM_CONFIG_UNSAFE_PERM=true
Angular version
Angular CLI: 17.3.8
Node: 20.12.1
Package Manager: npm 10.8.1
OS: win32 x64
Angular: 17.3.12
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1703.8
@angular-devkit/build-angular 17.3.8
@angular-devkit/core 17.3.8
@angular-devkit/schematics 17.3.8
@angular/cdk 17.3.10
@angular/cli 17.3.8
@angular/material 17.3.10
@schematics/angular 17.3.8
ng-packagr 17.3.0
rxjs 7.8.1
typescript 5.4.5
zone.js 0.14.8
npm up
or npm i <package>
commands work successfully. But when I try ng add
or ng update
, those fail. Do you have any ideas about how to solve this?
Thanks !
I tried to create a local .npmrc
with config:
strict-ssl = false
Tried to add process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
in node_modules/@angular/cli/bin/ng
Tried to find npm.js (like in GithHub issue) but doesn't exist in my version
Tried to run with line NODE_TLS_REJECT_UNAUTHORIZED
like NODE_TLS_REJECT_UNAUTHORIZED=0 ng update
(for Linux). I am in Windows with PowerShell so I run the command with $env:NODE_TLS_REJECT_UNAUTHORIZED=0; ng update
Unfortunately, all these solutions have failed.
Upvotes: 0
Views: 190