_From @BaggersIO on May 15, 2018 12:46_
x)- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] devkit
- [x] schematics
$ node --version
8.11.1
$ npm --version
5.6.0
Operating System: Windows 7
1) You need a private Artifactory repository using HTTPS + Basic Authentication.
2) .npmrc Configuration
registry=https://some.local.registry
ca[]="my cert ..."
strict-ssl=false
always-auth=true
[email protected]
3) Login via npm login
$ npm login
Username: foo
Password: ***
E-Mail: [email protected]
4) Run ng update
It does not matter if you use ng update or ng update xxx-package.
5) CLI / RegistryClient throws 401 for GET http://some.local.registry/...
The ng update command stops after a few minutes (~2-3 mins) without any exception.
I digged deeper into the update schematic at npm.js with few logs and got this:
{ Error: Registry returned 401 for GET on https://some.local.registry/artifactory/api/npm/npm-virtual/karma
聽 聽 at makeError (C:\dev\shared\node_modules\npm-registry-client\lib\request.js:316:12)
聽 聽 at RegClient.<anonymous> (C:\dev\shared\node_modules\npm-registry-client\lib\request.js:292:14)
聽 聽 at Request._callback (C:\dev\shared\node_modules\npm-registry-client\lib\request.js:216:14)
聽 聽 at Request.self.callback (C:\dev\shared\node_modules\request\request.js:188:22)
聽 聽 at emitTwo (events.js:126:13)
聽 聽 at Request.emit (events.js:214:7)
聽 聽 at Request.<anonymous> (C:\dev\shared\node_modules\request\request.js:1171:10)
聽 聽 at emitOne (events.js:116:13)
聽 聽 at Request.emit (events.js:211:7)
聽 聽 at IncomingMessage.<anonymous> (C:\dev\shared\node_modules\request\request.js:1091:12) pkgid: 'karma', statusCode: 401, code: 'E401' } { errors: [ { status: 401, message: 'Authentication is required' } ] }
Registry returned 401 for GET on https://some.local.registry/artifactory/api/npm/npm-virtual/karma
6) Quick and Dirty Hack to get it working
Since npm login has no effect, I had to patch npm.js in the update schematic to get it working:
const client = new RegistryClient({
proxy: {
http: options[0],
https: options[1],
}, ssl: {
strict: false, // This was needed but it is still fixed
}
});
client.log.level = 'silent';
const params = {
timeout: 30000,
auth: { // This was needed for authentication
alwaysAuth: true,
username: 'my_usenrame', // My artifactory username
password: 'my_encrypted_password' // My encrypted password
}
};
https://github.com/angular/devkit/blob/master/packages/schematics/update/update/npm.ts#L100-L116
Note: the strict-ssl patch is not needed anymore: https://github.com/angular/devkit/pull/838
With the hack above my ng update command worked well.
I logged out the following exception:
{ Error: Registry returned 401 for GET on https://some.local.registry/artifactory/api/npm/npm-virtual/karma
聽 聽 at makeError (C:\dev\shared\node_modules\npm-registry-client\lib\request.js:316:12)
聽 聽 at RegClient.<anonymous> (C:\dev\shared\node_modules\npm-registry-client\lib\request.js:292:14)
聽 聽 at Request._callback (C:\dev\shared\node_modules\npm-registry-client\lib\request.js:216:14)
聽 聽 at Request.self.callback (C:\dev\shared\node_modules\request\request.js:188:22)
聽 聽 at emitTwo (events.js:126:13)
聽 聽 at Request.emit (events.js:214:7)
聽 聽 at Request.<anonymous> (C:\dev\shared\node_modules\request\request.js:1171:10)
聽 聽 at emitOne (events.js:116:13)
聽 聽 at Request.emit (events.js:211:7)
聽 聽 at IncomingMessage.<anonymous> (C:\dev\shared\node_modules\request\request.js:1091:12) pkgid: 'karma', statusCode: 401, code: 'E401' } { errors: [ { status: 401, message: 'Authentication is required' } ] }
Registry returned 401 for GET on https://some.local.registry/artifactory/api/npm/npm-virtual/karma
npm login / authentication + private Artifactory works with ng update
_Copied from original issue: angular/devkit#917_
I'm seeing this, too.
$ node -v
v10.12.0
$ npm -v
6.4.1
Operating System: OS X High Sierra
@alexeagle could you please elaborate a bit more on the work-around for someone who just has npm and angular-cli installed locally?
This should be corrected in the latest CLI version (7.3.5). If the problems still persists, please open a new issue with updated environment and version information.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
I'm seeing this, too.
@alexeagle could you please elaborate a bit more on the work-around for someone who just has npm and angular-cli installed locally?