<h3 dir="auto">Current Behavior:</h3>
<p dir="auto">I am attempting to configure a project to install dependencies from NPM. I will be publishing the project to GitHub Packages as a private package. If I use this syntax in my project's <code class="notranslate">.npmrc</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@my-org:registry=https://npm.pkg.github.com/"><pre class="notranslate"><code class="notranslate">@my-org:registry=https://npm.pkg.github.com/
</code></pre></div>
<p dir="auto">I can install dependencies from NPM using <code class="notranslate">npm install</code> on my local machine. However, I cannot publish to GitHub Packages using <code class="notranslate">npm publish</code>. NPM informs me that I'm not authenticated. If I use this syntax in my project's <code class="notranslate">.npmrc</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="registry=https://npm.pkg.github.com/my-org/"><pre class="notranslate"><code class="notranslate">registry=https://npm.pkg.github.com/my-org/
</code></pre></div>
<p dir="auto">I can publish using <code class="notranslate">npm publish</code>, but I cannot install dependencies with <code class="notranslate">npm install</code>. NPM informs me that it's trying to install dependencies from GitHub Packages, rather than NPM.</p>
<h3 dir="auto">Expected Behavior:</h3>
<p dir="auto">Based on my reading, both syntaxes should be compatible with <code class="notranslate">npm install</code> and <code class="notranslate">npm publish</code>. However, it appears I can only use one or the other, based on my intended use.</p>
<h3 dir="auto">Steps To Reproduce:</h3>
<ol dir="auto">
<li>
<p dir="auto">Install Node <code class="notranslate">v15.7.0</code> and NPM <code class="notranslate">7.4.3</code> via <a href="https://github.com/nvm-sh/nvm">nvm</a>.</p>
</li>
<li>
<p dir="auto">Log in to GitHub Packages with the command:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="npm login --scope=@my-org --registry=https://npm.pkg.github.com"><pre class="notranslate">npm login --scope=@my-org --registry=https://npm.pkg.github.com</pre></div>
</li>
<li>
<p dir="auto">Check our <code class="notranslate">~/.npmrc</code> file in our home folder. It should read:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@my-org:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=&lt;auth-token-used-for-login&gt;"><pre class="notranslate"><code class="notranslate">@my-org:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=&lt;auth-token-used-for-login&gt;
</code></pre></div>
</li>
<li>
<p dir="auto">Create project with the following <code class="notranslate">package.json</code>:</p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;name&quot;: &quot;@my-org/my-package&quot;,
  &quot;description&quot;: &quot;A test.&quot;,
  &quot;version&quot;: &quot;1.0.0&quot;,
  &quot;scripts&quot;: {
    &quot;test&quot;: &quot;echo \&quot;Error: no test specified\&quot; &amp;&amp; exit 1&quot;
  },
  &quot;repository&quot;: {
    &quot;type&quot;: &quot;git&quot;,
    &quot;url&quot;: &quot;https://github.com/my-org/my-package.git&quot;
  },
  &quot;keywords&quot;: [&quot;example&quot;],
  &quot;author&quot;: &quot;Me&quot;,
  &quot;license&quot;: &quot;ISC&quot;,
  &quot;bugs&quot;: {
    &quot;url&quot;: &quot;https://github.com/my-org/my-package/issues&quot;
  },
  &quot;homepage&quot;: &quot;https://github.com/my-org/my-package&quot;,
  &quot;dependencies&quot;: {
    &quot;bootstrap&quot;: &quot;^4.5.2&quot;
  }
}"><pre class="notranslate">{
  <span class="pl-ent">"name"</span>: <span class="pl-s"><span class="pl-pds">"</span>@my-org/my-package<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"description"</span>: <span class="pl-s"><span class="pl-pds">"</span>A test.<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>1.0.0<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"scripts"</span>: {
    <span class="pl-ent">"test"</span>: <span class="pl-s"><span class="pl-pds">"</span>echo <span class="pl-cce">\"</span>Error: no test specified<span class="pl-cce">\"</span> &amp;&amp; exit 1<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"repository"</span>: {
    <span class="pl-ent">"type"</span>: <span class="pl-s"><span class="pl-pds">"</span>git<span class="pl-pds">"</span></span>,
    <span class="pl-ent">"url"</span>: <span class="pl-s"><span class="pl-pds">"</span>https://github.com/my-org/my-package.git<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"keywords"</span>: [<span class="pl-s"><span class="pl-pds">"</span>example<span class="pl-pds">"</span></span>],
  <span class="pl-ent">"author"</span>: <span class="pl-s"><span class="pl-pds">"</span>Me<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"license"</span>: <span class="pl-s"><span class="pl-pds">"</span>ISC<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"bugs"</span>: {
    <span class="pl-ent">"url"</span>: <span class="pl-s"><span class="pl-pds">"</span>https://github.com/my-org/my-package/issues<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"homepage"</span>: <span class="pl-s"><span class="pl-pds">"</span>https://github.com/my-org/my-package<span class="pl-pds">"</span></span>,
  <span class="pl-ent">"dependencies"</span>: {
    <span class="pl-ent">"bootstrap"</span>: <span class="pl-s"><span class="pl-pds">"</span>^4.5.2<span class="pl-pds">"</span></span>
  }
}</pre></div>
</li>
<li>
<p dir="auto">Add the following <code class="notranslate">.npmrc</code> to our project:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@my-org:registry=https://npm.pkg.github.com/"><pre class="notranslate"><code class="notranslate">@my-org:registry=https://npm.pkg.github.com/
</code></pre></div>
</li>
<li>
<p dir="auto">Run <code class="notranslate">npm install</code>. Installation should succeed.</p>
</li>
<li>
<p dir="auto">Run <code class="notranslate">npm publish</code>. Receive the following error:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="npm ERR! code ENEEDAUTH
npm ERR! need auth This command requires you to be logged in.
npm ERR! need auth You need to authorize this machine using `npm adduser`

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/my-user/.npm/_logs/2021-01-28T20_19_55_974Z-debug.log"><pre class="notranslate">npm ERR<span class="pl-k">!</span> code ENEEDAUTH
npm ERR<span class="pl-k">!</span> need auth This <span class="pl-c1">command</span> requires you to be logged in.
npm ERR<span class="pl-k">!</span> need auth You need to authorize this machine using <span class="pl-s"><span class="pl-pds">`</span>npm adduser<span class="pl-pds">`</span></span>

npm ERR<span class="pl-k">!</span> A <span class="pl-c1">complete</span> log of this run can be found in:
npm ERR<span class="pl-k">!</span>     /Users/my-user/.npm/_logs/2021-01-28T20_19_55_974Z-debug.log</pre></div>
</li>
<li>
<p dir="auto">Change the project <code class="notranslate">.npmrc</code> to:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="registry=https://npm.pkg.github.com/my-org/"><pre class="notranslate"><code class="notranslate">registry=https://npm.pkg.github.com/my-org/
</code></pre></div>
</li>
<li>
<p dir="auto">Run <code class="notranslate">npm publish</code>. Publishing should succeed.</p>
</li>
<li>
<p dir="auto"><code class="notranslate">rm -rf node_modules/ package-lock.json</code> in project.</p>
</li>
<li>
<p dir="auto">Run <code class="notranslate">npm install</code>. Receive following error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="npm ERR! code E401
npm ERR! Incorrect or missing password.
npm ERR! If you were trying to login, change your password, create an
npm ERR! authentication token or enable two-factor authentication then
npm ERR! that means you likely typed your password in incorrectly.
npm ERR! Please try again, or recover your password at:
npm ERR!     https://www.npmjs.com/forgot
npm ERR!
npm ERR! If you were doing some other operation then your saved credentials are
npm ERR! probably out of date. To correct this please try logging in again with:
npm ERR!     npm login

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/my-user/.npm/_logs/2021-01-28T20_38_20_711Z-debug.log"><pre class="notranslate"><code class="notranslate">npm ERR! code E401
npm ERR! Incorrect or missing password.
npm ERR! If you were trying to login, change your password, create an
npm ERR! authentication token or enable two-factor authentication then
npm ERR! that means you likely typed your password in incorrectly.
npm ERR! Please try again, or recover your password at:
npm ERR!     https://www.npmjs.com/forgot
npm ERR!
npm ERR! If you were doing some other operation then your saved credentials are
npm ERR! probably out of date. To correct this please try logging in again with:
npm ERR!     npm login

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/my-user/.npm/_logs/2021-01-28T20_38_20_711Z-debug.log
</code></pre></div>
</li>
</ol>
<h3 dir="auto">Environment:</h3>
<ul dir="auto">
<li>OS:
<ul dir="auto">
<li>MacOS Catalina 10.15.7 (Intel Mac Mini)</li>
<li>MacOS Big Sur 11.1 (Apple Silicon MacBook AIr)</li>
</ul>
</li>
<li>Node: 15.7.0</li>
<li>npm:
<ul dir="auto">
<li>7.4.3</li>
<li>7.5.2</li>
</ul>
</li>
</ul>
<h1 dir="auto">What / Why</h1>
<p dir="auto">Firstly please forgive any assertions I make that are completely wrong - I'm doing my best to understand something that is completely alien to me.</p>
<p dir="auto">I had been trying to work out why my new package was not having its man page installed despite following all of the documentation I can find and trying several different iterations of configuration. I have been tracking this down through npm, into Arborist - and I believe that the fault lies in Arborist - and as per <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="837065574" data-permission-text="Title is private" data-url="https://github.com/npm/cli/issues/2914" data-hovercard-type="issue" data-hovercard-url="/npm/cli/issues/2914/hovercard?comment_id=904696686&amp;comment_type=issue_comment" href="https://github.com/npm/cli/issues/2914#issuecomment-904696686">#2914 (comment)</a> I am beginning to believe that actually Arborist completely lacks support for creating - only deleting - man pages.</p>
<p dir="auto">What I <em>think</em> I know - but correct me where I'm totally off base:</p>
<ul dir="auto">
<li>The Node object constructed in Arborist gets given bin paths, but not man paths, from the raw package.json. I still haven't quite worked out where the raw package.json becomes the package object that is passed into the Node class constructor.</li>
<li>Nowhere in Arborist is there any defined reference or support for a man path meaning that it expects it to be either provided in the package object that is used to first populate the node object in the constructor, or it's expecting it to be populated dynamically by a subsequent call to bin-links/get-paths.getPaths()</li>
<li>The Arborist Node object is granted a getter called binPaths that calls bin-links/get-paths.getPaths() (aliased as getBinPaths)</li>
<li>However, Node.binPaths is only ever used twice in Arborist
<ul dir="auto">
<li>once in lib/diff.js to confirm all the paths exist</li>
<li>once in lib/arborist/reify.js under _addNodeToTrashList to make sure the binPaths are deleted on removal</li>
</ul>
</li>
</ul>
<p dir="auto">I believe that somewhere there is supposed to be a call to Node.binPaths that doesn't seem to exist. This call would return both the bin and man paths into the Node.package property that would be used later in bin-links/index.binLinks() to link both bins and man pages - but instead of calling Node.binPaths, it is just relying on the Node object having been instantiated with the bin property in the constructor's source data, rather than getting it through Node.binPaths.</p>
<p dir="auto">It should be noted that if Arborist was doing what I think it is supposed to be doing to get the paths and link them using bin-links; bin-links does not follow the NPM documentation which states that man paths can be a string or an Array, as there is a hard-check in bin-links/get-paths.getPaths() for an Array: (manTarg &amp;&amp; pkg.man &amp;&amp; Array.isArray(pkg.man) &amp;&amp; pkg.man.length)</p>
<p dir="auto">Additionally, I have seen documentation stating that you can also use package.json sugar to include a man directory in the directories property, which should include all man pages in the directory - but I see no support for that in Arborist or in bin-links.</p>
<h2 dir="auto">When</h2>
<p dir="auto">Performing any npm install of a package with man pages (though I am only testing with --global installs at the moment - I'm not sure what the linking logic is supposed to be in local mode).</p>
<h2 dir="auto">Where</h2>
<ul dir="auto">
<li>npm install npm</li>
<li>npm install orgtomate</li>
</ul>
<h3 dir="auto">Current Behavior</h3>
<p dir="auto">No man page links created. No errors.</p>
<h3 dir="auto">Steps to Reproduce</h3>
<p dir="auto">Install a package with man pages configured either:</p>
<ul dir="auto">
<li>As an man Array property in package.json</li>
<li>As an man string property in package.json</li>
<li>As a man string property in the directories property in package.json</li>
</ul>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">man pages installed into ${base}/share/man/ via symlinks - as successfully achieved with <code class="notranslate">npm link</code>, although <code class="notranslate">npm link</code> only works with a man Array property due to that being the only supported approach in <code class="notranslate">bin-links</code>.</p>
<h2 dir="auto">References</h2>
<ul dir="auto">
<li>Related to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="837065574" data-permission-text="Title is private" data-url="https://github.com/npm/cli/issues/2914" data-hovercard-type="issue" data-hovercard-url="/npm/cli/issues/2914/hovercard" href="https://github.com/npm/cli/issues/2914">#2914</a></li>
</ul>