I have played with npm set and npm config set for several times, now I want to reset to default values (a kind of factory reset).

Does npm provide a command to do that? Or should I delete all configuration files by hands then reinstall it?

I need to do it both on Linux CentOS and on Windows 8.

推荐答案

To reset user defaults

Run this in the command line (or git bash on windows):

echo "" > $(npm config get userconfig)
npm config edit

To reset global defaults

echo "" > $(npm config get globalconfig)
npm config --global edit

If you need sudo then run this instead:

sudo sh -c 'echo "" > $(npm config get globalconfig)'

Node.js相关问答推荐

可以删除一个mongodb catch块

赫斯基添加命令已弃用?

如何在MongoDB中更新嵌套数组

在内存中加载安全密钥安全吗?还是每次都从文件中读取?

ForbidenError:使用Express.js的CSRF令牌无效

通过PutObjectCommand上传AWS S3 PDF文件,结果为空PDF

FHIR 服务器:尽管 JSON 格式正确,但在 POST 请求中接收未定义请求正文

Mongodb - 在数组数组中查找()

Docker node_modules 文件夹上的 React 应用程序不可用

使用 Nodejs 获取 Firebase 云消息传递历史记录

npm chokidar 触发事件两次

带有事件网格的 Azure 函数在没有 ngrok 的情况下在本地运行

NestJS 共享模块的问题

如何在 cypress 测试中进行计算

在 Passport 策略回调中获取请求对象

Node.js + Express + Handlebars.js + 局部视图

eslint - vscode 的可选链接错误

Connect/Express 中的session和cookieSession中间件有什么区别?

Node.js + Express:应用程序不会开始监听端口 80

什么时候应该将函数存储到变量中?