fix(npm/pacote): allow tns to be able to use npm configuration properly #4992
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New PR for changes in #4905
PR Checklist
What is the current behavior?
If you have a npm registry that is not hosted by npm, the TNS cli will fail to install npm modules.
Doing a
npm i --save @proplugins/blah
will work 100% properly.Doing a
tns plugins add @proplugins/blah
will partially work. It actually downloads the package (because it apparently uses npm under the hood and pulls the file and unpacks it, yay!).So
node_modules/@proplugins/blah
is unpacked and exists on the drive.However, apparently the tns cli uses pacote to verify the existence of the registry entry, BEFORE it adds it to the

package.json
file. Which of course because it is a older verison of pacote and does not read the npm configuration -- it has NO idea how to resolve@scoped
to the private server. So tns then fails and so then tns throwsAs you can see from the image; npm actually found the package and installed it; but TNS failed and either rolls back the package.json change, or doesn't commit the package.json change.
What is the new behavior?
Upgraded to latest pacote library; and added ability to read npm configuration files (using the official libnpmconfig, which is then passed into pacote; so of course it now works properly. :-)
BREAKING CHANGES:
None
This is PR #4905 against Release branch...