Bug 1222167 - devel:languages:nodejs: npmrc/globalconfig move to /usr/etc?
Summary: devel:languages:nodejs: npmrc/globalconfig move to /usr/etc?
Status: NEW
Alias: None
Product: openSUSE.org
Classification: openSUSE
Component: 3rd party software (show other bugs)
Version: unspecified
Hardware: Other Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: Adam Majer
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-29 17:40 UTC by Andrew Daugherity
Modified: 2024-03-29 18:01 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Daugherity 2024-03-29 17:40:25 UTC
I'm not sure if this is a bug or an intentional change (either local or upstream), but since this has happened before (#1144919), I'm seeking clarity.

Basically, as of Node.js 16 the system-wide npmrc file, whose location can be queried with 'npm get globalconfig', has moved from /etc/nodejs/npmrc to /usr/etc/npmrc, and my settings in /etc/nodejs/npmrc are no longer being read.

For all versions of Node <= 14 (except 8, briefly), the path was /etc/nodejs/npmrc, but with >= 16 it's now /usr/etc/npmrc.  I know there's been an effort to put "distribution" settings in /usr/etc and "sysadmin" settings in /etc but AFAIK Node.js has not been patched for this?

Obviously I can move or symlink the file if it's an intended change.  In that old bug you mentioned it depending on prefix (globalconfig = $prefix/etc/npmrc), but that doesn't seem to track 100%.  Here's the output of a simple shell script to query 'npm$ver get globalconfig' and 'npm$ver get prefix':

Version	globalconfig	prefix
10:	/etc/nodejs/npmrc	/usr/local
14:	/etc/nodejs/npmrc	/usr/local
16:	/usr/etc/npmrc	/usr
18:	/usr/etc/npmrc	/usr
20:	/usr/etc/npmrc	/usr
21:	/usr/etc/npmrc	/usr

Despite the /usr prefix, 'npm21 install -g <something>' does still put it under /usr/local/lib/node_modules as intended, keeping /usr/lib64/node_modules for those installed as RPMs.

Thanks for any clarification you can provide (or fixes if needed)!
Comment 1 Andrew Daugherity 2024-03-29 18:01:51 UTC
Well, I see now that npm14 is the "legacy" 6.x; npm16 is 8.x and npm18 and newer is 10.x, and they take different syntaxes (e.g. "production=true" vs. "omit=dev"), so perhaps it's a good thing after all that the "legacy" and "new" npm use different config locations?