npm ci
安装一个干净的项目
概要
npm ci
示例
确保你有一个包锁和一个最新的安装:
$ cd ./my/npm/project
$ npm install
added 154 packages in 10s
$ ls | grep package-lock
在该项目中运行 npm ci
$ npm ci
added 154 packages in 5s
将 Travis 配置为使用 npm ci
而不是 npm install
构建:
# .travis.yml
install:
- npm ci
# keep the npm cache around to speed up installs
cache:
directories:
- "$HOME/.npm"
描述
此命令与 npm install
类似,不同之处在于它旨在用于自动化环境,例如测试平台、持续集成和部署——或任何您希望确保对依赖项进行全新安装的情况。通过跳过某些面向用户的功能,它可以比常规的 npm 安装快得多。它也比常规安装更严格,可以帮助捕获大多数 npm 用户增量安装的本地环境导致的错误或不一致。
cfh+FBDk0CVYX5mHlDA7LV3uKFiOW5LWyV9c680Ens87urhdrBxmy42t6RWW53qZkTBT74JLRh8g2zr4um+S2VPoe9unZZkS49+1/Ah55xt4J9YLl0XUtmWVfE6KHOzC
- SUc2ndgoJ9NhsUmlQ0lSjaq4q3vhdMBGZ0b9qFHyVY5zJHpDgV4vxfh+86ywT96cB/jGxHnwGD72FbqkQ4rvq6uCvM5I8HaU1qBQ60OcTIqwqPvHENbE507szAEZsJQWxhNvYKdKxiJb9OGaRbzGrJA9FCHCtI+6ty9HMjTMnax7WStgCJ38CivOlidA12aaaCH1nxYTRsXKAFU0I+Yo2x7mO2UNLKOLbycINFUkHCq+g3ef392jb0Cn7skHjmWuNrW0qccOaUSss68JgAjyIMrpbNRmkUcYcEUwGTlSbJdkKgJ8TJzxHlEXpSiI9WI4+sOreb917HizPpxbolh77YXKnMvHmQm4xoM6etTlLx5JNPmnWvSWhLDtKAgkgjTSO0jl5+QQGLeYzFFSpy8LOmwuLAejPJWrzgSIdRrYHZVodXU5eIH81G+hOL96BfUYL1skMZGmPccjsDIGOqJ5Kh04c3ChyuRlgUgDFRPQLZadrW57kB5jeSRU5GeOeHg/4PuRLFfkcXxWECwAJw/eK+cH5NUf8eFuZcvj8cTzb81fBHJAv7UZ89WhEmzvxdv9eF3RDFTBmBN/32f8WWIo9Yt1rfbFSf0FLiYudyC5iChbJvSV2U3sCVCszGxNjmuBc139fs2Vac/OtS7jlxDcr+KUKqiL0cpyryAg2neuoAlcwJHIpe6O1jvQnGlWn/tSZ85X6KGgW7vda0+RAUaJijUeE3nWaYWpIFfEtOqavjNBlwpm8R9shQ5+Z+7vYs614Vg7lWj2C9vFpCuysSXiIk8fws97+8EUJU4749qqIok=