V
V
Valery2016-01-14 13:33:32
Windows
Valery, 2016-01-14 13:33:32

What is the difference between npm install and npm update?

Hello,
I have the following: a project-to-project package.json containing packages for webpack.
I start a new project, copy package.json into it, run npm i without parameters. Some error will result when installing a completely random package from the list.
I run npm update - everything is ok.
But the current project is empty, even the node_modules folder doesn't exist yet. There shouldn't be a difference, but there is.
What makes them different?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kostya Gorozhanov, 2016-01-14
@Akuma

Most likely it's the dependencies of your modules, or their versions specified in your package.json.
When you run npm i, npm tries to install exactly the versions specified in package.json.
When npm update npm installs the latest versions and overwrites your package.json in the process.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question