npm common commands

1. Check the local npm version: npm -v

2. Upgrade the npm version: npm install npm@latest -g (@latest means the latest version)

3. View help for the specified command: npm specify command --help

4. View the npm help command: npm --help

5. Initialization: npm init

6. Initialization (skip wizard): npm init --yes (-y)

7. Download dependencies: npm install

8. Packages installed in the development environment: npm install package name --save-dev (npm install package name -D)

9. Packages installed in the development/production environment: npm install package name --save (npm install package name -S)

10. View the installed node packages in the current directory: npm list (npm ls --depth=search depth)

11. View the globally installed node packages: npm list -g

12. Update the specified package: npm update package name

13. Uninstall the specified package: npm uninstall package name

14. View configuration information: npm config list

15. View all version information of the specified package on remote npm: npm info specifies the package name

16. View the installation path of the current package: npm root

17. View the global package installation path: npm root -g

18. Check the specified package and version information installed locally. Empty is not displayed: npm ls package name

19. Check the specified package and version information installed globally. No empty is displayed: npm ls package name -g

20. Modify the package download source: npm config set registry download source

21. Install cnpm: npm install -g cnpm --registry=Download source

22. Automatically start the browser to open the package’s home page: npm home package name

23. Check the existing issues of the package, or the public roadmap: npm bugs package name

24. View the code address of the package: npm repo package name

25. View package details: npm info package name

26. Search npm repository: npm search string/regular expression

27. Check for outdated dependencies: npm outdated

28. Execute the script: npm run dev/build

29. Clean and install dependencies: npm ci

30. Remove duplicate dependencies: npm dedupe/ddp

31. Scan the project to find vulnerabilities in all dependencies: npm audit

32. Automatically install patch versions of all vulnerable packages: npm audit fix

33. Test the local package: npm link/npm link module name/npm unlink module name

Guess you like

Origin blog.csdn.net/qq_43305829/article/details/130701361