Reference: Npm and yarn command quick reference table
installed in global environment or installed in local environment **System common directory, node global environment Used when installing tools and commands used in the entire system
The environment in the application (project) that I made
For the added package, describe "Which package to install" in package.json in the application (project).
Used when installing packages used for each application
The package is installed in the global environment of node
** -g option means global environment **
** install can be omitted with i **
npm
npm install -g Package name
//The following is also OK
npm i -g Package name
yarn
yarn global add package name
Add --save to install to local environment
Once installed, it will be added to dependencies in the package.json file
npm
npm install --save package name
yarn
yarn add package name
Add --save-dev when installing
Once installed, it will be added to devDependencies in the package.json file
** --save-dev can be omitted with -D **
npm
npm install --save-dev package name
//The following is also OK
npm i -D Package name
yarn
yarn add --dev package name
Tips
package.json file **$ git pull origin master
//If you are developing on npm
$ npm install
//If developing with yarn
$ yarn install
        Recommended Posts