npm basic commands
npm -v: View version npm
npm install name: installing the module
npm uninstall name: module unload
npm list: View the current directory installed node package
npm info module name: View module information
package.json defines the various modules needed for the project, as well as configuration information projects
created package.json: npm init, npm init --yes
npm install xxx --save module information will be written to in the package.json Dependencies
npm install xxx --save dev-module information will be written to in the package.json devDependencies
NPM the install: The information in the package.json installation depends
The difference dependencies and devDependencies
dependencies: Configure current program relies on other packages
devDependencies: Configure the current program relies on other packages, it will only download the module, rather than downloading the testing and documentation framework of these modules
package.json version number
^
: Represents a version number change, taking back two latest
~
: that the first two the same, the last to take the latest
*
: that take all the latest
Taobao mirror installation
npm install -g cnpm --registry=https://registry.npm.taobao.org
alias cnpm="npm --registry=https://registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=https://npm.taobao.org/dist \
--userconfig=$HOME/.cnpmrc"
# Or alias it in .bashrc or .zshrc
$ echo '\n#alias for cnpm\nalias cnpm="npm --registry=https://registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=https://npm.taobao.org/dist \
--userconfig=$HOME/.cnpmrc"' >> ~/.zshrc && source ~/.zshrc
Synchronization:
CNPM Sync Connect
Open https://npm.taobao.org/sync/connect
cnpm supports all commands except npm publish the