Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

"npm i npm" creates package-lock.json file and does not update the version of npm. #20648

Open
saurabhghewari opened this issue May 17, 2018 · 8 comments

Comments

@saurabhghewari
Copy link

Hi NPM Team,

I am trying to update the npm by using the command npm i npm as suggested in terminal when there is an update. Following are my observations

  1. It starts looking package.json at the current location from where the command is fired.
  2. If package.json is found, it saves npm as dependencies.
  3. it creates package-lock.json file.
  4. It does not update the npm to latest version.

Platform Details:-
OS:- Ubuntu 64bit.
NODE:- 8.11 LTS

Why is updating npm saves npm as dependencies if command is run from some project folder?
Why is not updating itself?

Please help in this, as I dont want to use YARN.

@jspri
Copy link

jspri commented May 17, 2018

do npm i npm -g to install it globally

@saurabhghewari
Copy link
Author

Still its not updating.
image

@jspri
Copy link

jspri commented May 17, 2018

Sounds like a problem with your path. Try which npm to see where it is running from.

@saurabhghewari
Copy link
Author

/home/synerzip/.npm-global/bin/npm
This is the path.

@legodude17
Copy link
Contributor

@saurabhghewari what are the results of which npm, npm prefix -g, and echo "$PATH"?

@saurabhghewari
Copy link
Author

image

@kostayOK
Copy link

да у меня такая тоже проблема незанаю как решить

@kostayOK
Copy link

я нашел решение npm config set prefix /usr/local и все у меня заработало ! у вас наверное что то напутано с путями как и у меня . у меня mac os x и после этой команды я сделал sudo npm install npm@latest -g и вуаля все обновилось ! вот где я взял информацию
https://stackoverflow.com/questions/14803978/npm-global-path-prefix/14840304?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants