The problem
When using private registry with authorization required (e.g. Nexus or verdaccio), it's impossible to use patch-package, when using per-project auth
The reason is that patch-package tries to install package in temp folder, but since there's no .npmrc file with auth token - 401 error is thrown:
Note, that when using private registries, all the packages from NPM registry are usually proxied. Installing any of them requires user to be authorized.
Potential solution
I've managed to make it work locally by copying .npmrc file to the tmp repo.
My suggestion is to check if .npmrc file exists and copy it to temp repo. Also, maybe it's worth to consider copying .yarnrc as well
I can submit a PR :)
The problem
When using private registry with authorization required (e.g. Nexus or verdaccio), it's impossible to use patch-package, when using per-project auth
The reason is that patch-package tries to install package in temp folder, but since there's no
.npmrcfile with auth token - 401 error is thrown:npm ERR! code E401Note, that when using private registries, all the packages from NPM registry are usually proxied. Installing any of them requires user to be authorized.
Potential solution
I've managed to make it work locally by copying
.npmrcfile to the tmp repo.My suggestion is to check if
.npmrcfile exists and copy it to temp repo. Also, maybe it's worth to consider copying.yarnrcas wellI can submit a PR :)