gpt4 book ai didi

node.js - `npm install` 通过网络安装我项目的所有依赖项,即使它们已经安装或从缓存中可用

转载 作者:IT老高 更新时间:2023-10-28 23:06:29 27 4
gpt4 key购买 nike

每当我在我的项目目录中运行 npm install 时,npm 都会获取并安装所有依赖项,即使它们已经安装在 node_modules 中。 Npm 不会从我在 ~/.npm/ 中的缓存安装,即使我的缓存中已经有大量的包。

这是来自 npm config ls -l 的我的 npm 配置设置:

; cli configs
long = true
registry = "https://registry.npmjs.org/"

; userconfig /Users/jay/.npmrc
username = "jayhendren"

; globalconfig /Users/jay/local/nodejs/etc/npmrc
global = true
globalconfig = "/Users/jay/local/nodejs/etc/npmrc"
globalignorefile = "/Users/jay/local/nodejs/etc/npmignore"
prefix = "/Users/jay/local/nodejs"

; default values
always-auth = false
bin-links = true
browser = null
ca = null
cache = "/Users/jay/.npm"
cache-lock-retries = 10
cache-lock-stale = 60000
cache-lock-wait = 10000
cache-max = null
cache-min = 10
cert = null
color = true
depth = null
description = true
dev = false
editor = "/usr/bin/vim"
; email = "" (overridden)
engine-strict = false
fetch-retries = 2
fetch-retry-factor = 10
fetch-retry-maxtimeout = 60000
fetch-retry-mintimeout = 10000
force = false
git = "git"
git-tag-version = true
group = 20
heading = "npm"
https-proxy = null
ignore-scripts = false
init-module = "/Users/jay/.npm-init.js"
init.author.email = ""
init.author.name = ""
init.author.url = ""
init.license = "ISC"
json = false
key = null
link = false
local-address = undefined
loglevel = "http"
; long = false (overridden)
message = "%s"
node-version = "v0.10.25"
npat = false
onload-script = false
optional = true
parseable = false
production = false
proprietary-attribs = true
proxy = null
rebuild-bundle = true
registry = "https://registry.npmjs.org/"
rollback = true
save = false
save-bundle = false
save-dev = false
save-optional = false
searchexclude = null
searchopts = ""
searchsort = "name"
shell = "/bin/zsh"
shrinkwrap = true
sign-git-tag = false
strict-ssl = true
tag = "latest"
tmp = "/var/folders/sq/ls98jmdd09l__xwpxq3qqmpw0000gn/T/"
umask = 18
unicode = true
unsafe-perm = true
usage = false
user = "nobody"
user-agent = "node/v0.10.25 darwin x64"
userconfig = "/Users/jay/.npmrc"
; username = "" (overridden)
version = false
versions = false
viewer = "man"

有人知道为什么 npm 坚持一遍又一遍地获取新包吗?

最佳答案

要从缓存强制安装包,可以使用以下方式:

$ npm --cache-min 9999999 install

另请参阅: https://addyosmani.com/blog/using-npm-offline/

关于node.js - `npm install` 通过网络安装我项目的所有依赖项,即使它们已经安装或从缓存中可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21538899/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com