Also known as Node Package Manager
Used to install dependencies, share and consume useful and reusable code
There have been a number of attempts to de-throne NPM but NPM is king Twitter created Bower in 2014 and Facebook created Yarn in 2016, both have lost momentum
npm is written using node.js
Before you can use npm you must install node.js first.
Install node.js and npm
visit nodejs.org and download for Windows.
When you download node.js you automatically get npm installed as well.
This installs into the following folder:
You will need to restart your computer.
To check which packages are installed globally
You can use "-g" or "--g".
npm list -g
npm list --g
Check that node and npm are installed.
Open a command prompt and type following.
If you do not see version numbers then these are not installed.
node - 10.14.1
npm - 6.4.1
To install newer versions of Node and NPM download the installer from nodejs.org and run it again.
npm install -g _ is the global install flag
npm install -save _ means the package will appear in your dependencies
npm install -save-dev _ means the package will appear in your devDependencies
npm install -save-optional _ means the package will appear in your optionalDependencies
dependencies - these are modules required at runtime (--save)
devDependencies - these are modules only required during development (--save-dev)
npm install //installs all modules that are listed in the package.json file
npm update //updates all the packages in the node_modules and their directory dependencies
npm install --save-dev babel-preset-react ???
npm install --save-dev source-map-loader ???
npm cache clean --force
© 2020 Better Solutions Limited. All Rights Reserved. © 2020 Better Solutions Limited TopPrevNext