npm access
Set the access level on the published package
npm adduser
Add user
npm audit
Allows developers to analyze complex code and pinpoint specific bugs and defects
npm audit fix
Detect vulnerabilities in project dependencies and automatically install vulnerable dependencies that need to be updated without having to track and fix them yourself
npm bin
Displays the path to the bin folder of NPM
npm bugs
Detects whether a module package has an error in package access in a Web browser
npm build
Building a package
npm rebuild
Rebuild package
npm cache
Operation package cache:
NPM cache add Add a package to the cache. NPM cache add add a package to the cache. NPM cache add @Add a package to the cache NPM cache verify must be used to clear useless cache files and verify that the cache data is complete
npm ci
NPM ci, like the NPM install command, is used to install. Installation is faster, but all modules are installed at once, and there are restrictions such as the need for package-lock files
npm completion
NPM completion >> ~/. ZSH NPM Enables the automatic completion command. After setting the command, press TAB to prompt the NPM command
npm config
Manage NPM config file NPM config get registry Obtain NPM repository address NPM config list [– -json] Obtain NPM configuration information NPM config edit Edit NPM config Delete Deletes a configuration NPM set key val Sets a configuration NPM get key val Obtains a configuration NPM c === NPM config alias
npm dedupe
Remove duplicate dependent packages from multiple dependent packages and keep only one
npm dist-tag
Build a package NPM tag management. The tag function is to release a version based on a tag without interfering with the normal version release. The latest version will not be downloaded to the version generated by the tag. NPM dist-tag add @ [] Adds a tag to a version. If the latest tag is added, the version becomes the latest. NPM dist-tag rm Remove tag NPM dist-tag ls [] check the tag list
npm docs
Open the document address of the package
npm doctor
NPM diagnostic command, NPM will check and diagnose the environment where NPM is running, including the version of NPM, git version, file permissions used by NPM, NPM ping, etc
npm edit
Modifying package Contents
npm explore
Go into the specified package and execute some commands, such as update source code, recompile, etc
npm help
View the help information \ for a command
npm help-search
Find the list of documents that contain the keyword in the help document
npm info version
View the latest release information for a module, such as NPM info underscore Version
npm install
Installing dependency packages
After the installation, a node_modules directory is generated, which contains the installed node modules. Node can be installed in global mode or local mode. Running in local mode, the package will be installed in the local node_modules directory of your application code. In global mode, the Node package is installed to node_modules in the Node installation directory.
npm install -g
Install packages into the global environment
npm install @version
Installs the specified version of the module
npm install –save
While installing, write the information to package.json
If package.json is present in the project path, use the NPM install method to install all dependencies based on the Dependencies configuration
(In most cases, the latest version of the package is installed, and the dependencies of package.json are automatically updated when installing the package.)
This way you don’t have to submit node_modules to Github.
npm install pkg –save-dev
In most cases, the latest version of the package is installed, and devDependencies of package.json are automatically updated when the package is installed
npm install pkg –save-optional
In most cases, the latest version of the package is installed, and the optionalDependencies of package.json are automatically updated when the package is installed
npm install pkg –save-exact
Saved dependencies are configured with the exact version, rather than using NPM’s default Semver scope operator.
npm uninstall xxx (-g)
Uninstall the module
npm init
Json file, including name, version, author, etc
npm install-test
Install the dependencies and run the tests
npm link
Create a shortcut to the NPM package to the global NPM path
npm logout
Exit the currently logged NPM account
npm ls -g
View globally installed modules and dependencies
npm outdated
View the version expiration information in the current installed package
npm owner
Managing package owner NPM owner add [<@scope>/] Adding a user as the manager of a package NPM owner rm [<@scope>/] Removing a user as the manager of a package NPM owner ls [<@scope>/] View the manager of a package
npm pack
Pack the current NPM package into a compressed package
npm ping
Verify the connectivity and authentication of Registry
npm prefix
NPM prefix [-g] Displays the parent directory closest to package.json
npm profile
NPM profile get [- json | – parseable] [] for personal information NPM profile set [- json | – parseable] setting personal information NPM profile set password password NPM Profile enable – 2 fa [auth – and – writes | auth – only] set open double verify NPM profile disable – 2 fa close open double verify
npm prune
Remove packages that are not defined on package.json dependencies
npm publish
Compose NPM unpublish [< @ scope > /] [@] to cancel the distribution package, will issue the package is removed from the remote warehouse NPM publish [|] [- tag] [- access < public | restricted >] release a package
npm repo
Open the source repository page for the specified package in a browser
npm root
View the current package installation path NPM root -g View the global package installation path
npm run-script
Run the commands in scripts in package.json in the current directory
npm runSame as above
npm remove
Remove the package
npm restart
Run the restart command in scripts of package.json in the current directory. If not, run NPM stop and then NPM start
npm test
Run the test command from scripts in package.json in the current directory, if any
npm start
Run the start command in scripts in package.json in the current directory, if any
npm stop
Run the top command from scripts in package.json in the current directory, if any
npm star
Adds a package to the current user’s list of interests
npm unstar
Removes a package from the current user list
npm stars
Lists all interested packages for the user
npm search keyword
Find the module information that matches the keyword
npm team
Manage the team or add team members
npm token
Identity token management
npm update name
update
npm update -g npm
Upgrade NPM to the latest version
npm ls(npm list)
Lists all packages currently installed (view installed modules and dependencies)
Note: Node module searches start in the current directory where the code is executing, and the results depend on what’s under node_modules in the current directory. $NPM list parseable=true displays all node packages currently installed as directories
NPM –version (NPM -v)
View the NPM version
npm view pkg version
View the latest release of a package
npm view moduleNames
Note: To view the contents of a tag in the package.json folder, use $NPM view moduleName labelName
npm view moudleName dependencies:
View package dependencies
npm view moduleName repository.url:
View the source file address of the package
npm view moduleName engines:
Check the version of the Node on which the package depends
For reference: blog.csdn.net/weixin_4127…