Starting from Fedora 24, npm is a part of Node.js package and does not need to be installed separately. Therefore, to install both npm and Node.js, you need to run:
$ sudo dnf install nodejs
There are alternative versions available as Fedora Modules.
Note: Modules are available for all editions from Fedora 29, and on the Server Edition from Fedora 28.
To list all available versions, run:
$ dnf module list
And to install an alternative version, run a command similar to this:
$ sudo dnf module install nodejs:8
nvm (Node Version Manager) is a bash script to manage multiple Node.js versions. nvm makes it easier to install, uninstall, and switch between different versions. Visit it’s Github page to follow the latest installation instructions.
Yarn package manager is available since Fedora 29. You can install it by running:
$ sudo dnf install yarnpkg
Yarn can be used in the following manner:
$ yarnpkg add request $ yarn add request
Installing Node.js modules is covered in Node.js modules.
Create a directory for global installations inside your home directory:
Set the new directory path for npm:
npm config set prefix '~/.npm-global'
~/.profile file and add the following line:
Update your system variables with this command: