unofficial mirror of help-guix@gnu.org 
 help / color / Atom feed
* How should I be running `npm install …`?
@ 2020-04-30 14:59 Josh Marshall
  2020-04-30 15:06 ` Vivien Kraus
  2020-04-30 15:18 ` Jelle Licht
  0 siblings, 2 replies; 9+ messages in thread
From: Josh Marshall @ 2020-04-30 14:59 UTC (permalink / raw)
  To: help-guix

Hello all,

The is my work email, I’m usually on IRC as “anadon”.  My laptop broke, so please humor the account change.

Following the guide at https://medium.com/jeremy-keeshin/hello-world-for-javascript-with-npm-modules-in-the-browser-6020f82d1072 , I’m trying to run `npm install -g browserify` with the output below.  This is something others have certainly run into, but a quick google search does not turn up any useful results.  How should I be doing this?


```
npm WARN checkPermissions Missing write access to /gnu/store/39zkw3a8lxkxs7rmx4238959zc368075-node-10.19.0/lib/node_modules                                     npm ERR! code EACCES                                                            npm ERR! syscall access                                                         npm ERR! path /gnu/store/39zkw3a8lxkxs7rmx4238959zc368075-node-10.19.0/lib/node_modules                                                                         npm ERR! errno -13                                                              npm ERR! Error: EACCES: permission denied, access '/gnu/store/39zkw3a8lxkxs7rmx4238959zc368075-node-10.19.0/lib/node_modules'                                   npm ERR!  { [Error: EACCES: permission denied, access '/gnu/store/39zkw3a8lxkxs7rmx4238959zc368075-node-10.19.0/lib/node_modules']                              npm ERR!   stack:                                                               npm ERR!    'Error: EACCES: permission denied, access \'/gnu/store/39zkw3a8lxkxs7rmx4238959zc368075-node-10.19.0/lib/node_modules\'',                           npm ERR!   errno: -13,                                                          npm ERR!   code: 'EACCES',                                                      npm ERR!   syscall: 'access',                                                   npm ERR!   path:                                                                npm ERR!    '/gnu/store/39zkw3a8lxkxs7rmx4238959zc368075-node-10.19.0/lib/node_modules' }                                                                       npm ERR!                                                                        npm ERR! The operation was rejected by your operating system.                   npm ERR! It is likely you do not have the permissions to access this file as the current user                                                                   npm ERR!                                                                        npm ERR! If you believe this might be a permissions issue, please double-check the                                                                              npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator.                                                                                                               npm ERR! A complete log of this run can be found in:                            npm ERR!     /home/marshjo/.npm/_logs/2020-04-30T14_50_56_150Z-debug.log
```
---

The information in this email, including attachments, may be confidential and is intended solely for the addressee(s). If you believe you received this email by mistake, please notify the sender by return email as soon as possible.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How should I be running `npm install …`?
  2020-04-30 14:59 How should I be running `npm install …`? Josh Marshall
@ 2020-04-30 15:06 ` Vivien Kraus
  2020-04-30 15:13   ` [EXTERNAL]Re: " Josh Marshall
  2020-05-02  7:40   ` Dmitry Alexandrov
  2020-04-30 15:18 ` Jelle Licht
  1 sibling, 2 replies; 9+ messages in thread
From: Vivien Kraus @ 2020-04-30 15:06 UTC (permalink / raw)
  To: Josh Marshall, help-guix

Hello!

Le jeudi 30 avril 2020 à 14:59 +0000, Josh Marshall a écrit :
> Hello all,
> 
> The is my work email, I’m usually on IRC as “anadon”.  My laptop
> broke, so please humor the account change.
> 
> Following the guide at 
> https://medium.com/jeremy-keeshin/hello-world-for-javascript-with-npm-modules-in-the-browser-6020f82d1072
> , I’m trying to run `npm install -g browserify` with the output
> below.  This is something others have certainly run into, but a quick
> google search does not turn up any useful results.  How should I be
> doing this?

I am a mere guix user, so you may want to have another answer.

You cannot install anything globally with NPM in guix, because NPM is
installed in a read-only location (/gnu/store/).  This is required for
guix to work correctly.

You can use this trick:
https://github.com/sindresorhus/guides/blob/master/npm-global-without-sudo.md

Basically, it tells NPM to install to your home directory.  So that it
is still installed in a central location, but this location is read-
write.

Vivien



^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [EXTERNAL]Re: How should I be running `npm install …`?
  2020-04-30 15:06 ` Vivien Kraus
@ 2020-04-30 15:13   ` Josh Marshall
  2020-05-02  7:40   ` Dmitry Alexandrov
  1 sibling, 0 replies; 9+ messages in thread
From: Josh Marshall @ 2020-04-30 15:13 UTC (permalink / raw)
  To: Vivien Kraus, help-guix

This gets me what I need – thanks!

________________________________
From: Vivien Kraus <vivien@planete-kraus.eu>
Sent: Thursday, April 30, 2020 11:06:15 AM
To: Josh Marshall <Josh.Marshall@jax.org>; help-guix <help-guix@gnu.org>
Subject: [EXTERNAL]Re: How should I be running `npm install …`?

Hello!

Le jeudi 30 avril 2020 à 14:59 +0000, Josh Marshall a écrit :
> Hello all,
>
> The is my work email, I’m usually on IRC as “anadon”.  My laptop
> broke, so please humor the account change.
>
> Following the guide at
> https://medium.com/jeremy-keeshin/hello-world-for-javascript-with-npm-modules-in-the-browser-6020f82d1072
> , I’m trying to run `npm install -g browserify` with the output
> below.  This is something others have certainly run into, but a quick
> google search does not turn up any useful results.  How should I be
> doing this?

I am a mere guix user, so you may want to have another answer.

You cannot install anything globally with NPM in guix, because NPM is
installed in a read-only location (/gnu/store/).  This is required for
guix to work correctly.

You can use this trick:
https://github.com/sindresorhus/guides/blob/master/npm-global-without-sudo.md

Basically, it tells NPM to install to your home directory.  So that it
is still installed in a central location, but this location is read-
write.

Vivien

---

The information in this email, including attachments, may be confidential and is intended solely for the addressee(s). If you believe you received this email by mistake, please notify the sender by return email as soon as possible.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How should I be running `npm install …`?
  2020-04-30 14:59 How should I be running `npm install …`? Josh Marshall
  2020-04-30 15:06 ` Vivien Kraus
@ 2020-04-30 15:18 ` Jelle Licht
  1 sibling, 0 replies; 9+ messages in thread
From: Jelle Licht @ 2020-04-30 15:18 UTC (permalink / raw)
  To: Josh Marshall, help-guix

Hey Josh,


Josh Marshall <Josh.Marshall@jax.org> writes:

> Hello all,
>
> The is my work email, I’m usually on IRC as “anadon”.  My laptop broke, so please humor the account change.
>
> Following the guide at https://medium.com/jeremy-keeshin/hello-world-for-javascript-with-npm-modules-in-the-browser-6020f82d1072 , I’m trying to run `npm install -g browserify` with the output below.  This is something others have certainly run into, but a quick google search does not turn up any useful results.  How should I be doing this?

By default, guix' npm wants to install to some location in the store,
which is mounted read-only. If you want to use npm to manage package
installations on guix, one workaround is to add something like the
following to your `$HOME/.npmrc':

--8<---------------cut here---------------start------------->8---
prefix=/home/anadon/opt
--8<---------------cut here---------------end--------------->8---

You also need to make sure that `$HOME/opt/bin' is in your path
afterwards.

HTH,
 - Jelle


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How should I be running `npm install …`?
  2020-04-30 15:06 ` Vivien Kraus
  2020-04-30 15:13   ` [EXTERNAL]Re: " Josh Marshall
@ 2020-05-02  7:40   ` Dmitry Alexandrov
  2020-06-16 15:20     ` Gary Johnson
  1 sibling, 1 reply; 9+ messages in thread
From: Dmitry Alexandrov @ 2020-05-02  7:40 UTC (permalink / raw)
  To: Vivien Kraus; +Cc: Josh Marshall, help-guix

[-- Attachment #1: Type: text/plain, Size: 1000 bytes --]

Vivien Kraus <vivien@planete-kraus.eu> wrote:
> Le jeudi 30 avril 2020 à 14:59 +0000, Josh Marshall a écrit :
>> I’m trying to run `npm install -g browserify` with the output below.

>> npm ERR! path /gnu/store/39zkw3a8lxkxs7rmx4238959zc368075-node-10.19.0/lib/node_modules
>
> I am a mere guix user, so you may want to have another answer.

I am not even a Guix (the SD) user, but this made me curious.

> You cannot install anything globally with NPM in guix because NPM is installed in a read-only location (/gnu/store/)

So?  /usr/ in traditional GNU distributions might be read-only as well, but it does not impede npm(1) or pip(1) or whatever install things system-wide (given that operator utilize his superuser powers, of course), as there are plenty other hierarchies available.

Why is npm in Guix built with default ‘prefix’¹ (means, for --global actions) set to package directory under /gnu/store/ instead of, say, /usr/local?

---
¹
	$ npm config get prefix

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 511 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How should I be running `npm install …`?
  2020-05-02  7:40   ` Dmitry Alexandrov
@ 2020-06-16 15:20     ` Gary Johnson
  2020-06-16 21:06       ` Dmitry Alexandrov
  2020-06-17  4:09       ` Dejan Ranisavljevic
  0 siblings, 2 replies; 9+ messages in thread
From: Gary Johnson @ 2020-06-16 15:20 UTC (permalink / raw)
  To: Dmitry Alexandrov; +Cc: Josh Marshall, help-guix, Vivien Kraus

In Guix, all system-level packages and configuration files are created
by the package manager under /gnu/store. The /usr directory is empty on
a Guix system.

~Gary

Dmitry Alexandrov <321942@gmail.com> writes:

> Vivien Kraus <vivien@planete-kraus.eu> wrote:
>> Le jeudi 30 avril 2020 à 14:59 +0000, Josh Marshall a écrit :
>>> I’m trying to run `npm install -g browserify` with the output below.
>
>>> npm ERR! path /gnu/store/39zkw3a8lxkxs7rmx4238959zc368075-node-10.19.0/lib/node_modules
>>
>> I am a mere guix user, so you may want to have another answer.
>
> I am not even a Guix (the SD) user, but this made me curious.
>
>> You cannot install anything globally with NPM in guix because NPM is installed in a read-only location (/gnu/store/)
>
> So?  /usr/ in traditional GNU distributions might be read-only as well, but it does not impede npm(1) or pip(1) or whatever install things system-wide (given that operator utilize his superuser powers, of course), as there are plenty other hierarchies available.
>
> Why is npm in Guix built with default ‘prefix’¹ (means, for --global actions) set to package directory under /gnu/store/ instead of, say, /usr/local?
>
> ---
> ¹
> 	$ npm config get prefix


-- 
GPG Key ID: 7BC158ED
Use `gpg --search-keys lambdatronic' to find me
Protect yourself from surveillance: https://emailselfdefense.fsf.org
=======================================================================
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

Please avoid sending me MS-Office attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How should I be running `npm install …`?
  2020-06-16 15:20     ` Gary Johnson
@ 2020-06-16 21:06       ` Dmitry Alexandrov
  2020-06-17  4:09       ` Dejan Ranisavljevic
  1 sibling, 0 replies; 9+ messages in thread
From: Dmitry Alexandrov @ 2020-06-16 21:06 UTC (permalink / raw)
  To: Gary Johnson; +Cc: Josh Marshall, help-guix, Vivien Kraus

[-- Attachment #1: Type: text/plain, Size: 942 bytes --]

Gary Johnson <lambdatronic@disroot.org> wrote:
> Dmitry Alexandrov <321942@gmail.com> writes:
>> So?  /usr/ in traditional GNU distributions might be read-only as well, but it does not impede npm(1) or pip(1) or whatever install things system-wide (given that operator utilize his superuser powers, of course), as there are plenty other hierarchies available.
>>
>> Why is npm in Guix built with default ‘prefix’¹ (means, for --global actions) set to package directory under /gnu/store/ instead of, say, /usr/local?
>
> In Guix, all system-level packages and configuration files are created by the package manager under /gnu/store. The /usr directory is empty on a Guix system.

Yes, and thatʼs exactly why I am asking: why npm(1) is preconfigured to attempt to install its packages into the hierarchy, which should be monopolistically managed by guix(1), while there are no shortage of free prefixes?

Is that merely a bug?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 511 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How should I be running `npm install …`?
  2020-06-16 15:20     ` Gary Johnson
  2020-06-16 21:06       ` Dmitry Alexandrov
@ 2020-06-17  4:09       ` Dejan Ranisavljevic
  2020-06-17 14:58         ` [EXTERNAL]Re: " Josh Marshall
  1 sibling, 1 reply; 9+ messages in thread
From: Dejan Ranisavljevic @ 2020-06-17  4:09 UTC (permalink / raw)
  To: Gary Johnson; +Cc: Dmitry Alexandrov, Josh Marshall, Vivien Kraus, help-guix

To use different directory for global packages, you have to create ~/.npmrc
dotfile with:

prefix=~/.npm

Once you have that you should be able to do npm i -g, and package would be
installed in ~/.npm
Also don't forget to add ~/.npm/bin in your PATH:

export PATH="$HOME/.npm/bin:$PATH"

Hope this helps.

Best,
Dejan

On Tue, 16 Jun 2020 at 17:21, Gary Johnson <lambdatronic@disroot.org> wrote:

> In Guix, all system-level packages and configuration files are created
> by the package manager under /gnu/store. The /usr directory is empty on
> a Guix system.
>
> ~Gary
>
> Dmitry Alexandrov <321942@gmail.com> writes:
>
> > Vivien Kraus <vivien@planete-kraus.eu> wrote:
> >> Le jeudi 30 avril 2020 à 14:59 +0000, Josh Marshall a écrit :
> >>> I’m trying to run `npm install -g browserify` with the output below.
> >
> >>> npm ERR! path
> /gnu/store/39zkw3a8lxkxs7rmx4238959zc368075-node-10.19.0/lib/node_modules
> >>
> >> I am a mere guix user, so you may want to have another answer.
> >
> > I am not even a Guix (the SD) user, but this made me curious.
> >
> >> You cannot install anything globally with NPM in guix because NPM is
> installed in a read-only location (/gnu/store/)
> >
> > So?  /usr/ in traditional GNU distributions might be read-only as well,
> but it does not impede npm(1) or pip(1) or whatever install things
> system-wide (given that operator utilize his superuser powers, of course),
> as there are plenty other hierarchies available.
> >
> > Why is npm in Guix built with default ‘prefix’¹ (means, for --global
> actions) set to package directory under /gnu/store/ instead of, say,
> /usr/local?
> >
> > ---
> > ¹
> >       $ npm config get prefix
>
>
> --
> GPG Key ID: 7BC158ED
> Use `gpg --search-keys lambdatronic' to find me
> Protect yourself from surveillance: https://emailselfdefense.fsf.org
> =======================================================================
> ()  ascii ribbon campaign - against html e-mail
> /\  www.asciiribbon.org   - against proprietary attachments
>
> Please avoid sending me MS-Office attachments.
> See http://www.gnu.org/philosophy/no-word-attachments.html
>
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [EXTERNAL]Re: How should I be running `npm install …`?
  2020-06-17  4:09       ` Dejan Ranisavljevic
@ 2020-06-17 14:58         ` Josh Marshall
  0 siblings, 0 replies; 9+ messages in thread
From: Josh Marshall @ 2020-06-17 14:58 UTC (permalink / raw)
  To: Dejan Ranisavljevic, Gary Johnson
  Cc: Dmitry Alexandrov, Vivien Kraus, help-guix

That does help, but it ought to be the default in many ways.

From: Dejan Ranisavljevic<mailto:dejan@ranisavljevic.com>
Sent: Wednesday, June 17, 2020 12:10 AM
To: Gary Johnson<mailto:lambdatronic@disroot.org>
Cc: Dmitry Alexandrov<mailto:321942@gmail.com>; Josh Marshall<mailto:Josh.Marshall@jax.org>; help-guix@gnu.org<mailto:help-guix@gnu.org>; Vivien Kraus<mailto:vivien@planete-kraus.eu>
Subject: [EXTERNAL]Re: How should I be running `npm install …`?

To use different directory for global packages, you have to create ~/.npmrc dotfile with:

prefix=~/.npm

Once you have that you should be able to do npm i -g, and package would be installed in ~/.npm
Also don't forget to add ~/.npm/bin in your PATH:

export PATH="$HOME/.npm/bin:$PATH"

Hope this helps.

Best,
Dejan

On Tue, 16 Jun 2020 at 17:21, Gary Johnson <lambdatronic@disroot.org<mailto:lambdatronic@disroot.org>> wrote:
In Guix, all system-level packages and configuration files are created
by the package manager under /gnu/store. The /usr directory is empty on
a Guix system.

~Gary

Dmitry Alexandrov <321942@gmail.com<mailto:321942@gmail.com>> writes:

> Vivien Kraus <vivien@planete-kraus.eu<mailto:vivien@planete-kraus.eu>> wrote:
>> Le jeudi 30 avril 2020 à 14:59 +0000, Josh Marshall a écrit :
>>> I’m trying to run `npm install -g browserify` with the output below.
>
>>> npm ERR! path /gnu/store/39zkw3a8lxkxs7rmx4238959zc368075-node-10.19.0/lib/node_modules
>>
>> I am a mere guix user, so you may want to have another answer.
>
> I am not even a Guix (the SD) user, but this made me curious.
>
>> You cannot install anything globally with NPM in guix because NPM is installed in a read-only location (/gnu/store/)
>
> So?  /usr/ in traditional GNU distributions might be read-only as well, but it does not impede npm(1) or pip(1) or whatever install things system-wide (given that operator utilize his superuser powers, of course), as there are plenty other hierarchies available.
>
> Why is npm in Guix built with default ‘prefix’¹ (means, for --global actions) set to package directory under /gnu/store/ instead of, say, /usr/local?
>
> ---
> ¹
>       $ npm config get prefix


--
GPG Key ID: 7BC158ED
Use `gpg --search-keys lambdatronic' to find me
Protect yourself from surveillance: https://emailselfdefense.fsf.org
=======================================================================
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org<http://www.asciiribbon.org>   - against proprietary attachments

Please avoid sending me MS-Office attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

---

The information in this email, including attachments, may be confidential and is intended solely for the addressee(s). If you believe you received this email by mistake, please notify the sender by return email as soon as possible.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, back to index

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-30 14:59 How should I be running `npm install …`? Josh Marshall
2020-04-30 15:06 ` Vivien Kraus
2020-04-30 15:13   ` [EXTERNAL]Re: " Josh Marshall
2020-05-02  7:40   ` Dmitry Alexandrov
2020-06-16 15:20     ` Gary Johnson
2020-06-16 21:06       ` Dmitry Alexandrov
2020-06-17  4:09       ` Dejan Ranisavljevic
2020-06-17 14:58         ` [EXTERNAL]Re: " Josh Marshall
2020-04-30 15:18 ` Jelle Licht

unofficial mirror of help-guix@gnu.org 

Archives are clonable:
	git clone --mirror https://yhetil.org/guix-user/0 guix-user/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guix-user guix-user/ https://yhetil.org/guix-user \
		help-guix@gnu.org
	public-inbox-index guix-user

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.gnu.guix.user
	nntp://news.gmane.io/gmane.comp.gnu.guix.user


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git