npmnpm<command>Usage:npminstallinstall all the dependencies in your project
npminstall<foo>add the <foo> dependency to your project
npmtest run this project's tests
npm run <foo> run the script named <foo>npm<command>-h quick help on <command>npm-l display usage info for all commands
npmhelp<term> search forhelp on <term>npmhelpnpmmore involved overviewAll commands:access, adduser, audit, bugs, cache, ci, completion,config, dedupe, deprecate, diff, dist-tag, docs, doctor,edit, exec, explain, explore, find-dupes, fund, get, help,hook, init, install, install-ci-test, install-test, link,ll, login, logout, ls, org, outdated, owner, pack, ping,pkg, prefix, profile, prune, publish, query, rebuild, repo,restart, root, run-script, search, set, shrinkwrap, star,stars, start, stop, team, test, token, uninstall, unpublish,unstar, update, version, view, whoamiSpecify configs in the ini-formatted file:/Users/jwdmac2/.npmrc
or on the command line via: npm<command>--key=valueMore configuration info: npmhelp config
Configuration fields: npmhelp7 confignpm@9.5.1 /usr/local/lib/node_modules/npm
npm i express@next added 53 packages, and audited 54 packages in 27s2 packages are looking for fundingrun `npm fund`for details3 high severity vulnerabilitiesTo address issues that do not require attention, run:npm audit fixTo address all issues (including breaking changes), run:npm audit fix --forceRun `npm audit`for details.
卸載包: npm remove / r 包名 (r是remove簡寫) npm uninstall 包名 用 npm i 安裝的模塊要用 npm uninstall i 才卸載掉,不加 i 無法卸載。
npm uninstall i expressremoved 53 packages, and audited 1 package in 2sfound 0 vulnerabilities
sudonpminstall express -g
Password:added 58 packages in 16s8 packages are looking for fundingrun `npm fund`for details
sudo 允許系統管理員讓普通用戶執行一些或者全部的root命令
升級全部包: npm update
npm updateup to date, audited 1 package in 387msfound 0 vulnerabilities
升級指定包: npm update 包名
npm update expressup to date, audited 1 package in 249msfound 0 vulnerabilities
下載當前項目所依賴的包: npm install
npminstallup to date, audited 1 package in 119msfound 0 vulnerabilities
設置鏡像源: npm config set registry 地址
1.臨時使用npm--registry https://registry.npm.taobao.org install express2.持久使用npm config set registry https://registry.npm.taobao.org配置后可通過下面方式來驗證是否成功npm config get registry 或 npm info express
npm cache clean
npm ERR! As of npm@5, the npm cache self-heals from corruption issues
npm ERR! by treating integrity mismatches as cache misses. As a result,
npm ERR! data extracted from the cache is guaranteed to be valid. If you
npm ERR! want to make sure everything is consistent, use `npm cache verify`npm ERR! instead. Deleting the cache can only makenpm go slower, and is
npm ERR! not likely to correct any problems you may be encountering!npm ERR!npm ERR! On the other hand, if you're debugging an issue with the installer,
npm ERR! or race conditions that depend on the timing of writing to an empty
npm ERR! cache, you can use `npm install --cache /tmp/empty-cache` to use a
npm ERR! temporary cache instead of nuking the actual one.
npm ERR!
npm ERR! If you're sure you want to delete the entire cache, rerun this commandnpm ERR! with --force.npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jwdmac2/.npm/_logs/2023-07-06T08_04_31_132Z-debug-0.log
清除項目中沒有被使用的依賴: npm prune
npm pruneup to date, audited 1 package in 272msfound 0 vulnerabilities
打開默認瀏覽器跳轉到github中axios的頁面: npm repo axios
npm repo axios
npm i 和 npm install 的區別
npm i 安裝的模塊及依賴,使用npm uninstall是沒有辦法刪除的,必須使用npm uninstall i才可以刪除。