help-guix
[Top][All Lists]
Advanced

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

Re: npm 'command not found' while node js is installed ?


From: Wojtek Kosior
Subject: Re: npm 'command not found' while node js is installed ?
Date: Wed, 19 Oct 2022 21:34:30 +0200

> Hi Guixers,
> 
>   I installed nodejs package. 
> When i go 'npm' in the shell i'm getting a 'command not found' error message.
> 
> how to get 'npm' working ? what am i missing ?
> 
> thanks, thanks, thanks
> 
> Fenix

Hi there,

I suppose you're that either
* you're using some Guix version that does not include the npm command
  in `node` package or
* you don't have Guix profile's `bin/` directory in your PATH variable.

The second seems more likely. I don't know if the first one is
possible, actually (I have no clue about the history of `node` package).

Try

    guix shell -C node -- npm --help

to verify that npm is available in your current Guix version. You
perhaps realize what this command does. Just in case - it runs
`npm --help` in a container. If it works (i.e. npm's `--help` output is
printed), it means your PATH variable did not contain the path to the
profile with npm and that was the cause of your problem. Fix it by
editing your shell initialization files. These are e.g. `~/.bashrc` and
`~/.profile`. Or others depending on the shell you're using.

Btw, you can verify that npm is indeed present in Guix by running

    guix time-machine --commit=a86979b41a49a8fcdaa887970ba594dbba701226 -- 
shell -C node -- npm --help

This will use a fixed version of Guix to run npm in a container. But
this way neither incorrectly initialized PATH variable nor outdated
`node` package will be able to cause you problems. The `time-machine`
command might take some time to finish upon the first run... I'm giving
it here as an interesting example - you shouldn't need `time-machine`
for merely installing npm :)

Please tell if you managed to fix the problem

Good luck,
Wojtek

-- (sig_start)
website: https://koszko.org/koszko.html
PGP: https://koszko.org/key.gpg
fingerprint: E972 7060 E3C5 637C 8A4F  4B42 4BC5 221C 5A79 FD1A

Meet Kraków saints!           #11: saint Jacek Odrowąż
Poznaj świętych krakowskich!  #11: święty Jacek Odrowąż
https://pl.wikipedia.org/wiki/Jacek_Odrowąż
-- (sig_end)

Attachment: pgpFD7xkYW4tC.pgp
Description: OpenPGP digital signature


reply via email to

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