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,
解决步骤
定位包含tmp配置的文件
执行以下命令查看所有npm配置的来源,找到带有tmp配置的条目:npm config list --show-origin输出中会显示每个配置项的来源文件路径,比如
~/.npmrc(用户级)或/usr/local/etc/npmrc(系统级)。删除tmp配置项
用文本编辑器打开找到的配置文件,例如编辑用户主目录下的.npmrc:nano ~/.npmrc删除所有包含
tmp的行(比如tmp=/var/tmp这类配置),保存并退出编辑器。验证修复效果
重新执行npm --version,确认警告信息不再出现。
如果警告仍存在,检查是否有多个配置文件包含tmp项,重复上述步骤删除即可。同时可执行nvm current确认当前使用的是nvm管理的Node.js版本,避免系统级npm干扰。
内容的提问来源于stack exchange,提问作者spawnTREx
相关产品推荐
相关产品推荐

