使用npm set 设置 package.json 默认值

当初始化 package.json 可以执行

npm init -y
复制代码

会得到如下结果

如果需要设置默认值

npm set init.license "MIT"
npm set init.author.email  "[email protected]"
npm set init.author.name  "Yun.kou"
复制代码

删除 package.json 再来一遍

rm package.json 
npm init -y
复制代码

可以看到设置的默认值

如果你想看默认值和编辑可以查看 ~/.npmrc

vim  ~/.npmrc
复制代码

猜你喜欢

转载自juejin.im/post/5bd9ae0b5188257f667aee23
今日推荐