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.

Be a good citizen on Windows and use appropriate directories.

See original GitHub issue

TL;DR: On Windows, node-gyp should install into %LOCALAPPDATA%/<vendor>/<product>.

In Linux, the accepted location to store :allthethings: is the home directory (~). On Windows, this is not appropriate and almost nothing should go into the root of the USERPROFILE directory or HOME directory. At the moment, node-gyp installs into ~ on Windows 10. It should instead install to somewhere more appropriate such as:

  • %APPDATA%/<vendor>/<product> for small user config of a particular product. Note, this is synced over a network/internet so nothing in here should be particularly large.
  • %LOCALAPPDATA%/<vendor>/<product> for large user config/extensions/per-user app installs/per-user caching. This folder is not synced over a network/internet so it can be big. Also, it is often redirected to a larger slower drive.
  • %PROGRAMDATA%/<vendor>/<product> for local (not synced over network) multi-user configuration data. This data is more permissive in that any user can read/write to it unlike %PROGRAMFILES% which is read only for everyone but admins. Care should be taken with regards to security any executable written here.
  • %PROGRAMFILES%/<vendor>/<product> for multi-user application data. Only admins can write here, but everyone can read. Good place to put installed software.

For the case of node_gyp, I assume that %LOCALAPPDATA%/<vendor>/<product> or %PROGRAMFILES%/<vendor>/<product> is the appropriate location, depending on whether there is an expectation of admin rights at install time.

Note: None of the above folders are %USERPROFILE% because the only thing that should use that folder are save dialogs. 😄

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:10
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

7reactions
bnoordhuiscommented, Feb 20, 2017

Any change in the defaults is probably automatically semver-major. That means that even if node-gyp makes the switch, it won’t end up on user’s systems for a long time.

So far no one has complained either so I’d be inclined to leave well enough alone. Changes to the defaults are disruptive to users. Unless there are strongly compelling reasons it’s probably not worth doing.

6reactions
MicahZoltucommented, Feb 21, 2017

So far no one has complained either so I’d be inclined to leave well enough alone

This is me complaining. 😄 %USERPROFILE% is the starting point for many user interactions on Windows. When applications like node-gyp (and others) throw a bunch of garbage (things end-users don’t ever need to look at/see) into this folder it means that my starting point for all of these user interactions are in the midst of a bunch of garbage I don’t want to see. If I want to play some music I have to sift through piles of “trash” that various applications have decided to dump into %USERPROFILE% to find my Music folder. Same if I want to view some pictures or open a document. Normally my strategy for dealing with bad-acting applications like this is to go find/use an alternative. At the moment, however I’m working on a project that requires Node (and node-gyp) so that isn’t a tenable solution for me this time, hence the Issue submission and PR.

Changes to the defaults are disruptive to users. Unless there are strongly compelling reasons it’s probably not worth doing.

I believe the way I acquired node-gyp was by doing an npm install of some project (though it is possible I got it some other way). If the path were to change, wouldn’t it just be re-downloaded to the new location (with cruft left in the old location)? Perhaps there are multiple ways to acquire node-gyp that aren’t as auto-magic and won’t self-heal?

If there is a desire to maintain backward compatibility, I am willing to adjust my naive PR to check first to see if .node-gyp exists in %USERPROFILE% and if it does set that to the dev-dir and if not then set the correct path to dev-dir. Then on the next major version bump the fallback code can be removed.

If there is a desire to remove the cruft I can add some code that will cleanup the old location if present and use the new location for everything else.

Read more comments on GitHub >

github_iconTop Results From Across the Web

15 ways to improve File Explorer or Windows ... - Digital Citizen
All the files and folders are underlined and open with a single click. 4. Stop File Explorer from showing recently used files, and...
Read more >
Proper usage of the windows user profile directory
Being a good application citizen, you should use: [drive]:\Documents and Settings[username]\Application Data[AppName] or [drive]:\Documents ...
Read more >
How to be a Good Citizen - Berlin, CT
Be kind to yourself. Hold the door open for others. Do NOT liter. Pick up trash in the park. Respect the boundaries of...
Read more >
Canine Good Citizen (CGC) - American Kennel Club
Take the CGC Test. Whether you and your dog have completed CGC classes, worked with a private trainer or practiced at home, when...
Read more >
I Can Be A Good Citizen Teaching Resources - TPT
This is an activity choice board that students can complete to demonstrate ethical use of the Internet. PLEASE NOTE: A blank line is ......
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