Linux command
npm-install 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Install all dependencies
npm install
Install specific package
npm install [package]
Install as dev dependency
npm install -D [package]
Install specific version
npm install [package]@[version]
Install globally
npm install -g [package]
Install from git
npm install [git+https://github.com/user/repo.git]
Clean install (CI)
npm ci
说明
npm install (or npm i) installs packages and their dependencies. Without arguments, it installs everything in package.json. With package names, it adds them to the project.
参数
- -D, --save-dev
- Save as devDependency.
- -g, --global
- Install globally.
- -E, --save-exact
- Save exact version.
- --no-save
- Don't update package.json.
- --legacy-peer-deps
- Ignore peer dep conflicts.
- --force
- Force fetch packages.
FAQ
What is the npm-install command used for?
npm install (or npm i) installs packages and their dependencies. Without arguments, it installs everything in package.json. With package names, it adds them to the project.
How do I run a basic npm-install example?
Run `npm install` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -D, --save-dev do in npm-install?
Save as devDependency.