Issue 1:
Current Behavior:

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 .npmrc:

@my-org:registry=https://npm.pkg.github.com/

I can install dependencies from NPM using npm install on my local machine. However, I cannot publish to GitHub Packages using npm publish. NPM informs me that I'm not authenticated. If I use this syntax in my project's .npmrc:

registry=https://npm.pkg.github.com/my-org/

I can publish using npm publish, but I cannot install dependencies with npm install. NPM informs me that it's trying to install dependencies from GitHub Packages, rather than NPM.

Expected Behavior:

Based on my reading, both syntaxes should be compatible with npm install and npm publish. However, it appears I can only use one or the other, based on my intended use.

Steps To Reproduce:

Install Node v15.7.0 and NPM 7.4.3 via nvm.

Log in to GitHub Packages with the command:

npm login --scope=@my-org --registry=https://npm.pkg.github.com

Check our ~/.npmrc file in our home folder. It should read:

@my-org:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=<auth-token-used-for-login>

Create project with the following package.json:

{
"name": "@my-org/my-package",
"description": "A test.",
"version": "1.0.0",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/my-org/my-package.git"
},
"keywords": ["example"],
"author": "Me",
"license": "ISC",
"bugs": {
"url": "https://github.com/my-org/my-package/issues"
},
"homepage": "https://github.com/my-org/my-package",
"dependencies": {
"bootstrap": "^4.5.2"
}
}

Add the following .npmrc to our project:

@my-org:registry=https://npm.pkg.github.com/

Run npm install. Installation should succeed.

Run npm publish. Receive the following error:

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

Change the project .npmrc to:

registry=https://npm.pkg.github.com/my-org/

Run npm publish. Publishing should succeed.

rm -rf node_modules/ package-lock.json in project.

Run npm install. Receive following error:

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

Environment:

OS:

MacOS Catalina 10.15.7 (Intel Mac Mini)

MacOS Big Sur 11.1 (Apple Silicon MacBook AIr)

Node: 15.7.0

npm:

7.4.3

7.5.2

Issue 2:
What / Why

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.

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 #2914 (comment) I am beginning to believe that actually Arborist completely lacks support for creating - only deleting - man pages.

What I think I know - but correct me where I'm totally off base:

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.

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()

The Arborist Node object is granted a getter called binPaths that calls bin-links/get-paths.getPaths() (aliased as getBinPaths)

However, Node.binPaths is only ever used twice in Arborist

once in lib/diff.js to confirm all the paths exist

once in lib/arborist/reify.js under _addNodeToTrashList to make sure the binPaths are deleted on removal

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.

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 && pkg.man && Array.isArray(pkg.man) && pkg.man.length)

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.

When

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).

Where

npm install npm

npm install orgtomate

Current Behavior

No man page links created. No errors.

Steps to Reproduce

Install a package with man pages configured either:

As an man Array property in package.json

As an man string property in package.json

As a man string property in the directories property in package.json

Expected Behavior

man pages installed into ${base}/share/man/ via symlinks - as successfully achieved with npm link, although npm link only works with a man Array property due to that being the only supported approach in bin-links.

References

Related to #2914