[npm common commands]

nodejs

node -v to view the version of nodejs (no version number appears, indicating that node js has not been installed successfully)
nodejs definition: JavaScript running on the server
can read and write local files
, operate the database
, run nodejs
node js file
node index.js

cmd command

Enter the CMD window

  1. win+R run command
  2. Enter cmd Enter to enter
  3. Switch the drive letter and add ":" D: C:
    path./current
    directory
    /root directory
    .../previous directory
    .../.../previous directory of the previous layer

NPM

The package (plug-in) manager that comes with nodejs.
Nmp init
initializes the project and creates a package.json project configuration file.
npm init -y
initializes the project and selects yes.
Check version npm -v

installation source

npm config set registry url
Change the download source to Taobao
npm config set registry http://registry.npm.taobao.org
View the installation source
npm config get registry

folder explanation

package.json (project configuration file)
1.dependencies
required by the project (dependencies required by the product environment) 2.
What
instructions does the scripts
project
have The download address of the package


Install

npm install
npm install jquery
npm i jquery
1. Specify the version to install
npm i [email protected]
2. Install all dependencies defined by package.json
npm i
3. Globally install
npm i -g
npm i js-cookie -g
4. Development depends on
npm i -D
npm i --save
npm i jquery -S
5. Product dependencies (default)
npm i -S
npm i --save
npm i jquery -S

uninstall

npm uninstall
npm uninstall jquery
npm r jquery

Version

2.1.4
XYZ
2 X major version, the major version is incompatible update
1 Y medium version, with new content, the original project is compatible
4 Z minor version minor version, solved several bugs
^3.6.0 Update is not>=4.xxx locked version
3.6.0 can not be updated, fixed this version

help command

npm install -h
npm uninstall -h

Guess you like

Origin blog.csdn.net/topuu/article/details/125260266