node.js - SSD 与 HDD 作为 npm 配置中的性能因素:在哪里放置 .npm 缓存和 node_modules 目录以获得最佳性能?
问题描述
考虑一台配备 256GB SSD 和 1TB HDD 的双驱动器笔记本电脑,应该将.npm
缓存和node_modules
目录放在哪里才能获得最佳性能?
任何其他建议热烈欢迎。
供您参考:
- 我的整个
/home/username
分区都在硬盘上。 - 我用
nvm
- 这是整个 npm 配置(使用
npm config ls -l
命令提取):
; cli configs
long = true
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.9.0 node/v10.15.3 linux x64"
; default values
access = null
allow-same-version = false
also = null
always-auth = false
audit = true
audit-level = "low"
auth-type = "legacy"
before = null
bin-links = true
browser = null
ca = null
cache = "/home/username/.npm"
cache-lock-retries = 10
cache-lock-stale = 60000
cache-lock-wait = 10000
cache-max = null
cache-min = 10
cafile = undefined
cert = null
cidr = null
color = true
commit-hooks = true
depth = null
description = true
dev = false
dry-run = false
editor = "vi"
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
global = false
global-style = false
globalconfig = "/home/username/.nvm/versions/node/v10.15.3/etc/npmrc"
globalignorefile = "/home/username/.nvm/versions/node/v10.15.3/etc/npmignore"
group = 1001
ham-it-up = false
heading = "npm"
https-proxy = null
if-present = false
ignore-prepublish = false
ignore-scripts = false
init-author-email = ""
init-author-name = ""
init-author-url = ""
init-license = "ISC"
init-module = "/home/username/.npm-init.js"
init-version = "1.0.0"
json = false
key = null
legacy-bundling = false
link = false
local-address = undefined
loglevel = "notice"
logs-max = 10
; long = false (overridden)
maxsockets = 50
message = "%s"
; metrics-registry = null (overridden)
node-options = null
node-version = "10.15.3"
noproxy = null
offline = false
onload-script = null
only = null
optional = true
otp = null
package-lock = true
package-lock-only = false
parseable = false
prefer-offline = false
prefer-online = false
prefix = "/home/username/.nvm/versions/node/v10.15.3"
preid = ""
production = false
progress = true
proxy = null
read-only = false
rebuild-bundle = true
registry = "https://registry.npmjs.org/"
rollback = true
save = true
save-bundle = false
save-dev = false
save-exact = false
save-optional = false
save-prefix = "^"
save-prod = false
scope = ""
script-shell = null
scripts-prepend-node-path = "warn-only"
searchexclude = null
searchlimit = 20
searchopts = ""
searchstaleness = 900
send-metrics = false
shell = "/bin/bash"
shrinkwrap = true
sign-git-commit = false
sign-git-tag = false
sso-poll-frequency = 500
sso-type = "oauth"
strict-ssl = true
tag = "latest"
tag-version-prefix = "v"
timing = false
tmp = "/tmp"
umask = 18
unicode = true
unsafe-perm = true
update-notifier = true
usage = false
user = 1001
; user-agent = "npm/{npm-version} node/{node-version} {platform} {arch}" (overridden)
userconfig = "/home/username/.npmrc"
version = false
versions = false
viewer = "man"
解决方案
好吧,SSD驱动器具有更好的性能,简单的答案是:将所有东西都放在SSD上。
如果您受到磁盘空间的限制,那么我会将.npm
缓存的文件夹移动到 SSD,因为它由每个yarn/npm install
.
推荐阅读
- angular - 在 Angular/Formly 中过滤数组
- vega-lite - Vega-Lite 图表 x 轴显示不显示新年开始后的月份
- python - 我应该如何/使用什么数据库将可查询列表存储在数据库中?链接表似乎非常过度和缓慢?
- javascript - 根据反应路由器中的路由更改元素的类名
- swiftui - SwiftUI Toggle 无法转换“布尔”类型的值?到预期的参数类型'绑定
' - python - 如何使用 php.. 中内置的 api 中的 Python(NLP/ML 等)卷曲数据?
- typescript - 打字稿条件类型缺少属性
- amazon-web-services - AWS S3 静态网站未从子域启动
- regex - Bash 在字符串上使用匹配正则表达式和后向模式
- python - 退出代码 0 但没有输出