Ask Your Question
3

how get the latest npm on fedora 26

asked 2017-09-29 19:37:30 -0600

christianbueno gravatar image

updated 2017-09-30 10:18:10 -0600

pc
fedora-26


 peter  ~  uname -r
4.12.14-300.fc26.x86_64
I installed nodejs by run
sudo dnf install nodejs

the installed version of npm is 3.10.10

the commands shared in the offical website image description

sudo npm install npm@latest -g
doesn't work


 peter  ~  sudo npm install npm@latest -g
- asap@2.0.5 nodemodules/npm/nodemodules/asap
- fstream@1.0.10 nodemodules/npm/nodemodules/fstream
- fstream-npm@1.2.0 nodemodules/npm/nodemodules/fstream-npm
- normalize-git-url@3.0.2 nodemodules/npm/nodemodules/normalize-git-url
- realize-package-specifier@3.0.3 nodemodules/npm/nodemodules/realize-package-specifier
/usr/lib
└── (empty)

npm ERR! Linux 4.12.14-300.fc26.x8664 npm ERR! argv "/usr/bin/node" "/bin/npm" "install" "npm@latest" "-g" npm ERR! node v6.11.3 npm ERR! npm v3.10.10 npm ERR! path /usr/lib/nodemodules/npm/node_modules/columnify npm ERR! code EEXIST npm ERR! errno -17 npm ERR! syscall mkdir

npm ERR! EEXIST: file already exists, mkdir '/usr/lib/nodemodules/npm/nodemodules/columnify' npm ERR! File exists: /usr/lib/nodemodules/npm/nodemodules/columnify npm ERR! Move it away, and try again.

npm ERR! Please include the following file with any support request: npm ERR! /home/peter/npm-debug.log npm ERR! code 1


 peter  ~  npm -v
bash: /usr/bin/npm: No such file or directory

edit retag flag offensive close merge delete

Comments

Webpage said:

npm install npm@latest -g

your command:

sudo npm install latest@npm -g
doesn't work
villykruse gravatar imagevillykruse ( 2017-09-30 04:37:46 -0600 )edit

Is a mistake of me writing the post, but you can see the right command typed in the the terminal. Error corrected. Thanks

christianbueno gravatar imagechristianbueno ( 2017-09-30 10:17:21 -0600 )edit

For any body happy people, If you want to get npm version 3.10.10 again. Run the command

sudo dnf reinstall npm
christianbueno gravatar imagechristianbueno ( 2017-09-30 10:24:21 -0600 )edit

1 Answer

Sort by » oldest newest most voted
3

answered 2017-09-30 03:27:42 -0600

davidva gravatar image

mmm, I don't recommend you update using npm!! I share with you a simple solution; generally some packages requires a new or old npm+nodejs; then a updated npm in fedora is bad some times...

Simple and fast solution (works for me building some rpms), you can use nvm...

get nvm

git clone git://github.com/creationix/nvm.git ~/nvm

activate nvm (you can put any version)

echo "source ~/nvm/nvm.sh" >> ~/.bashrc
source ~/.bashrc
nvm install 8.6.0
nvm use 8.6.0
edit flag offensive delete link more

Comments

thanks pal

christianbueno gravatar imagechristianbueno ( 2017-10-01 13:17:46 -0600 )edit

Don't worry if you installed nodejs by dnf. You could check that there are not any nodejs installed with the command

nvm ls

Now , if you want to install the latest node LTS run nvm install --lts now check again and see the different result. It automatic begin using the installed nodejs. Now check version of nodejs and npm

node --version
npm --version

Now there does possible to update/upgrade npm , only run

npm install npm@latest -g

thanks

christianbueno gravatar imagechristianbueno ( 2017-10-01 13:31:53 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-09-29 19:37:30 -0600

Seen: 5,155 times

Last updated: Sep 30 '17