guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: npm global prefix needs to be a writeable directory


From: Jelle Licht
Subject: Re: npm global prefix needs to be a writeable directory
Date: Thu, 26 Nov 2020 07:35:38 +0100

Hey,

Ryan Prior <ryanprior@hey.com> writes:

> Hi folks! I stumbled across an issue with the node package today and
> wanted to send a report before I forget.
>
> npm assumes that the global prefix is a writeable folder. Operations
> like `npm link` will fail if it isn't. Right now our node package
> doesn't set a prefix, so it defaults to the package's directory in the
> store, which isn't good.

On other distros it defaults to a location that is not writable by
normal users either; it has been considered bad form to install packages
into this default global prefix using sudo for about as long as node has
been released. So I would rather say; "npm expects you to use sudo for
everything" or "npm expects you to manage your global prefix yourself"
:-)

> Maybe the solution is to select a folder inside the user's Guix profile
> (or perhaps in their XDG_CACHE_HOME, if any) and set that explicitly as
> the node global prefix using a profile hook.

Node doesn't do this on other distros either, correct?

> In my case, I ran `npm config set prefix /home/ryan/.cache/npm` as a
> workaround.

Having users set up a valid prefix is already the cannonical solution
for this exact problem, so I don't directly see why guix preventing you
from doing what you shouldn't be doing in the first place should require
extra patching.

Another way folks solved this problem has been using "nvm" which in
practice boiled down to exactly the same thing (that is, setting a
custom global prefix, just managed by nvm now).

Just my 2 cents though.

- Jelle



reply via email to

[Prev in Thread] Current Thread [Next in Thread]