Be the first user to complete this post
|Add to List|
Installing, Listing and Uninstalling packages using npm
npm install and
npm update commands. However, you ought to know a little bit more about the different options available to you during package install.
npm install packagename
npm install express --save
npm install command, npm will install exact same versions of your packages that were specified in your package json therefore preventing your code from breaking due to updates to packages.
The next interesting happens when you realize that you actually have two kinds of packages - ones that are required for your applications to run and others that you use as tools that help you during development - such as jshint, grunt, grunt tasks, minification, sass compilers etc etc.
Since these packages are only required by the developer, they dont need to be installed by someone else that might use your package in the future. The reason why it is important to make this distinction is because when someone else who mentions your package as dependency in their project issues an
npm install, npm will also go ahead and install all the packages specified in your 'dependencies'. npm cannot distinguish between mandatory packages and development-only packages. Well at least not unless you tell it to.
The correct way to specify development only packages is by listing them in your package.json under the key 'devDependencies'. And just like before, you don't need to remember the package version numbers of these packages. You can install them by simply running the npm install command with the --save-dev option as shown
npm install grunt --save-dev
npm list --depth=0
npm list -g --depth=0
npm uninstall packagename
npm prune --production
- Use node in es6 syntax with babel transpiling
- Setup nginx with multi domain websites running on nodejs
- set the default node version using nvm
- Understanding nodejs module exports and require
- Configuring jshint as a pre-commit hook for your nodejs applications
- Setup passportjs for local authentication and authorization using expressjs
- What is an npmignore file and what is it used for