question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why not auto-detect NPM registry from .npmrc?

See original GitHub issue

I see in discussion from #16 that the OP wanted to install dependencies in a package from a private registry, and the subsequent support for that through the --registry option.

My question is, why does install-peerdeps not work alongside npm (or yarn) by using settings that are already set in ~/.npmrc (or ~/.yarnrc), especially with respect to use of a private NPM registry.

For example, I have published eslint-config-myconfig in my private registry, the URL of which I’ve configured in my ~/.npmrc file. So, if I run this command to query the package’s peer dependencies:

$ npm info eslint-config-myconfig peerDependencies --json
{
  "@typescript-eslint/eslint-plugin": ">=2.21 <3",
  "@typescript-eslint/parser": ">=2.21 <3",
  "eslint": ">=6.8 <7",
  "eslint-config-airbnb-typescript": ">=7 <8",
  "eslint-config-prettier": ">=6.10 <7",
  "eslint-plugin-import": ">=2.20 <3",
  "eslint-plugin-prettier": ">=3.1 <4",
  "eslint-plugin-security": ">=1.4 <2",
  "prettier": ">=1.19 <2",
  "typescript": ">=3.8 <4"
}

It just works!

The same should be true when it comes to installing those peer dependencies. When spawning a child process to run npm (or yarn), just let the underlying package manager read its own configuration file.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
amclincommented, May 1, 2020

I’ll take a look at branching this and see what I come up.

1reaction
ljharbcommented, Feb 27, 2020

It could certainly shell out to npm config get registry.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[json] Autodetect npm registry in package.json dependencies ...
I noted here that NPM's default registry is hardcoded, even if a custom registry was set by npm config set registry . Is...
Read more >
npm not reading .npmrc file - node.js - Stack Overflow
In case anyone has the same issue as me. We have a private registry but before adding the . npmrc file I tried...
Read more >
registry - npm Docs
To resolve packages by name and version, npm talks to a registry website that implements the CommonJS Package Registry specification for reading package...
Read more >
Configuration Options - Renovate Docs
Typically, the constraint is detected automatically by Renovate from files within the repository and there is no need to manually configure it. Manually ......
Read more >
Set up your client's npmrc - Azure Artifacts - Microsoft Learn
vsts-npm-auth is not recognized ... If you're running into the following error: ... Then it's likely that the npm modules folder is not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found