You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Linux Mint系统VS Code内置终端npm运行异常问题求助

解决npm "tmp This setting is no longer used" 警告

问题场景

在Linux Mint系统中,通过nvm更新Node.js和npm后,执行任何npm命令都会重复出现以下警告:

npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
npm WARN config location in the cache, and they are managed by
npm WARN config cacache.

执行npm --version时输出示例:

npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
npm WARN config location in the cache, and they are managed by
npm WARN config     cacache.
9.6.1npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
npm WARN config location in the cache, and they are managed by
npm WARN config     cacache.
9.6.1,

解决步骤

  1. 定位包含tmp配置的文件
    执行以下命令查看所有npm配置的来源,找到带有tmp配置的条目:

    npm config list --show-origin
    

    输出中会显示每个配置项的来源文件路径,比如~/.npmrc(用户级)或/usr/local/etc/npmrc(系统级)。

  2. 删除tmp配置项
    用文本编辑器打开找到的配置文件,例如编辑用户主目录下的.npmrc:

    nano ~/.npmrc
    

    删除所有包含tmp的行(比如tmp=/var/tmp这类配置),保存并退出编辑器。

  3. 验证修复效果
    重新执行npm --version,确认警告信息不再出现。

如果警告仍存在,检查是否有多个配置文件包含tmp项,重复上述步骤删除即可。同时可执行nvm current确认当前使用的是nvm管理的Node.js版本,避免系统级npm干扰。

内容的提问来源于stack exchange,提问作者spawnTREx

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.28 22:27:47