Npm
“npm”(Node Package Manager)提供 npm install、npm run script 与 npm registry。package.json 声明依赖与脚本;package-lock.json 锁定版本。pnpm、yarn 是替代方案,但 npm 仍最普及。
- “Run npm install after cloning the repository.” (克隆仓库后运行 npm install。)
- “The CI pipeline executes npm test on every commit.” (CI 流水线在每次提交时执行 npm test。)
- “They published the library to the public npm registry.” (他们将库发布到公共 npm registry。)
缩写:Node + Package + Manager。
首字母缩写。
npm 生态体量巨大;需注意 supply chain 安全与 lockfile 提交;npx 可一次性运行 CLI 包。
- 固定搭配: “npm package” (npm 包), “npm script” (npm 脚本), “npm registry” (npm registry)
- 文件: package.json, package-lock.json
- 替代: pnpm, yarn
Node 项目的 Package Manager——npm。
“A deprecated npm dependency triggered security alerts until the team upgraded the transitive package.” (过时的 npm 依赖引发安全告警,直到团队升级了传递依赖。)