-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Global npm module npmrc garbles pnpm output on stdin with warning #5682
Description
pnpm version:
7.17.0
Code to reproduce the issue:
npm -g i pnpm npmrc
pnpm list --json # in any packageExpected behavior:
Only JSON on stdout.
Actual behavior:
The following warning appears on stdout, before any JSON output:
WARN Issue while reading "~/Library/Application Support/fnm/node-versions/v16.14.2/installation/lib/node_modules/npmrc". EISDIR: illegal operation on a directory, read
Additional information:
There seem to be multiple issues in combination here, and I don’t know what you would consider the best fix:
-
@pnpm/cli-utilsprints warnings to stdout rather than stderr – seems straightforward to change this toconsole.warn(…), but maybe there were reasons to useconsole.log(…)? -
@pnpm/npm-conftries to readnode_modules/npm/../npmrcas file, creating a warning if that does not succeed, but ignoring the'ENOENT'case. Sincenpmrcis a valid npm package name (albeit conflicting with config files), maybe it would be appropriate to ignore the'EISDIR'case, too.
This is happening in an environment at my company where I have no control whether the callers of my script (which uses pnpm) have npmrc installed as a global package. Many of them have, because a different project (close to mine) installs it in its setup script.