node.js - SSD 与 HDD 作为 npm 配置中的性能因素 : where to put . npm 缓存和 node_modules 目录以实现最佳性能?

标签 node.js npm nvm

考虑一台配备 256GB SSD 和 1TB HDD 的双驱动笔记本电脑,应该将 .npm 缓存和 node_modules 目录放在哪里才能获得最佳性能?

热烈欢迎任何其他建议。

供您引用:

  • 我的整个 /home/username 分区都在 HDD 上。
  • 我使用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 共享。

关于node.js - SSD 与 HDD 作为 npm 配置中的性能因素 : where to put . npm 缓存和 node_modules 目录以实现最佳性能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55903666/

相关文章:

javascript - Express res.sendFile 强制下载而不是提供 HTML

javascript - 简单的 NPM 包捆绑/销售?

node.js - 运行 npm install 时 node-sass 出错

linux - Raspberry PI 2 nodejs 在我打开时没有安装

javascript - 无法让 ESM 与 Knex CLI v0.21.5 一起使用

javascript - req.user 未定义,但登录工作正常

javascript - 将数组的每个元素写入文件的新行的最佳方法是什么?

javascript - 在 Jest 中重置 Node 模块

npm - 运行Webpack时: EACCES,打开 '/build/bundle.js'错误

node.js - 锁定 NPM 版本?