Answer the question
In order to leave comments, you need to log in
How to install dependencies from a past project into a new package.json?
I read that it's enough just to transfer the package.json to a new project and run the command
npm i
--saveor
--save-devor it does not play a role in any way and you can install packages simply
npm i name?
Answer the question
In order to leave comments, you need to log in
There is no command, but --save
there is --save-prod
(which is not needed, because by default).
--save-dev
- obviously installs devDependencies.
Development dependencies go to devDependencies, dependencies for the application itself go to dependencies (by default). For local development, there is no difference (except for the organization) - they all fly in a bunch to node_modules, however, if you make your own ready-made module for npm, then when you install such a module, only the usual dependencies will be installed.
npm i
this is a short version npm install
Without parameters, it installs dependencies from package.json and if there is a package-lock.json file, it normalizes the node_modules folder according to it.
npm i name
will install the package name version tagged with latest (the default tag) will
npm i [email protected]
install the package name version tagged with tag will
npm i [email protected]
install the package name version 5.xx where xx is the last of 5 will
npm i [email protected]
install the package name version 5.3.x where x is the last of 5.3 will
npm i [email protected]
install the package name version 5.3 The .1
parameter --save
or its short version -S
will store the dependency in package.json in the dependencies section, this has been the default behavior for some time now when package.json is present
the parameter --save-dev
or its short version -D
will save the dependency in package.json in the devDependencies section.
And only you can decide how to install in your particular case.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question