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.

[for discussion] move default localStorage location under $HOME

See original GitHub issue

i ran into a problem when trying out your cash project. With my nodejs/npm setup, global installs require sudo: sudo npm i -g cash

however, because of that, cash doesn’t have permissions to write to its own localstorage directory:

$ cash
fs.js:794
  return binding.mkdir(pathModule._makeLong(path),
                 ^

Error: EACCES: permission denied, mkdir '/Users/tenaciousmv/npm/lib/node_modules/cash/node_modules/vorpal/dist/.local_storage'

obviously i don’t want to run cash with sudo 😃

isn’t it more typical to put this kind of storage in ~/.vorpal or ~/.cash or somewhere else under $HOME?

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:3
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
goodevilgeniuscommented, Mar 2, 2017

For reference, this is how yarn does it:

function getDirectory(category: string): string {
  // use %LOCALAPPDATA%/Yarn on Windows
  if (process.platform === 'win32' && process.env.LOCALAPPDATA) {
    return path.join(process.env.LOCALAPPDATA, 'Yarn', category);
  }

  // otherwise use ~/.{category}/yarn
  return path.join(userHome, `.${category}`, 'yarn');
}

function getCacheDirectory(): string {
  if (process.platform === 'darwin') {
    return path.join(userHome, 'Library', 'Caches', 'Yarn');
  }

  return getDirectory('cache');
}

So, getCacheDirectory() returns $HOME/.cache/yarn on Linux, %LOCALAPPDATA%\Yarn\cache on Windows, and $HOME/Libarary/Caches/Yarn on macOS.

I think something like that would be a good option for vorpal.

1reaction
goodevilgeniuscommented, Mar 2, 2017

I know this is an old issue, but I just found it, while trying to figure out where this was stored.

I think using os.tmpdir() isn’t a good idea, as, on some OSs (like Linux), this may default to a volatile directory. These files may not persist after a reboot.

I think the original suggestion of it being somewhere in the home directory is better. There’s frequently a .cache directory in $HOME. That’s where, e.g., yarn stores its module cache.

Read more comments on GitHub >

github_iconTop Results From Across the Web

LocalStorageExport default storage location - HowTo
On your computer, open Chrome. · At the top right, click More. Settings. · At the bottom, click Advanced. · Under the “Downloads”...
Read more >
Chrome 61: Local Storage Location Changed? - Super User
James Amos, you'll right, new place location storage is *.ldb file. %localappdata%\Google\Chrome\User Data\Default\Local Storage\leveldb see ...
Read more >
Prevent Access to Local Storage via Developer Tools?
No, you can't. Even if there is a temporary 'solution' or hack that seems to work, it is still the web, so there...
Read more >
LocalStorage and SessionStorage | Web Storage APIs
SessionStorage and LocalStorage are known as the web storage API. Data can be stored on the client side by using these APIs. SessionStorage:....
Read more >
Cannot choose or change local storage path on Windows 10 ...
First approach · Create a local "Storage" and give it a name · Go to general settings · Go to "Import" · In...
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