From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id cMNTHuBMv18PKQAA0tVLHw (envelope-from ) for ; Thu, 26 Nov 2020 06:36:16 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 8C4mGuBMv1/vaAAA1q6Kng (envelope-from ) for ; Thu, 26 Nov 2020 06:36:16 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 04FA3940253 for ; Thu, 26 Nov 2020 06:36:15 +0000 (UTC) Received: from localhost ([::1]:37002 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kiAt4-0001dN-OT for larch@yhetil.org; Thu, 26 Nov 2020 01:36:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36336) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kiAse-0001bm-9K for guix-devel@gnu.org; Thu, 26 Nov 2020 01:35:48 -0500 Received: from mail1.fsfe.org ([2001:aa8:ffed:f5f3::151]:60004) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kiAsc-0005Kg-9E for guix-devel@gnu.org; Thu, 26 Nov 2020 01:35:47 -0500 From: Jelle Licht To: Ryan Prior , Development of GNU Guix and the GNU System distribution Subject: Re: npm global prefix needs to be a writeable directory In-Reply-To: References: Date: Thu, 26 Nov 2020 07:35:38 +0100 Message-ID: <86im9sd3r9.fsf@fsfe.org> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2001:aa8:ffed:f5f3::151; envelope-from=jlicht@fsfe.org; helo=mail1.fsfe.org X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: inc X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=fsfe.org (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Spam-Score: -0.91 X-TUID: sBwElgT0rDWy Hey, Ryan Prior 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