Node.js/npm/指令:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
创建页面,内容为“== 安装路径 == === 路径 === {{shc_out|<syntaxhighlight lang="bash"> npm root -g</syntaxhighlight>|<syntaxhighlight lang="text"> /usr/local/lib/node_modules</syntaxhighlight>|$}} === 环境 === {{shc_out|<syntaxhighlight lang="bash"> npm config ls</syntaxhighlight>|<syntaxhighlight lang="text"> ; cli configs metrics-registry = "https://registry.npm.taobao.org/" scope = "" user-agent = "npm/6.14.5 node/v12.18.1 linux x64" ; userconfig /home/kangjian/.npmrc…”
 
Kangkk​(留言 | 贡献)
第32行: 第32行:
{{shc|<syntaxhighlight lang="bash">
{{shc|<syntaxhighlight lang="bash">
npm config set prefix *</syntaxhighlight>|$}}
npm config set prefix *</syntaxhighlight>|$}}
== 命令 ==
=== config ===
{{Shc_out|<syntaxhighlight lang="bash">
npm config edit</syntaxhighlight>|<syntaxhighlight lang="bash">;;;;
; npm userconfig file: /Users/kangjian/.npmrc
// ...
...
</syntaxhighlight>|$|/home/kangkk}}
//
{{Shc_out|<syntaxhighlight lang="bash">
npm who am i</syntaxhighlight>|<syntaxhighlight lang="bash">kangjian
</syntaxhighlight>|$|/home/kangkk}}
//
{{Shc_out|<syntaxhighlight lang="bash">
npm config set strict-ssl false</syntaxhighlight>|<syntaxhighlight lang="bash">
</syntaxhighlight>|$|/home/kangkk}}
//
{{Shc_out|<syntaxhighlight lang="bash">
npm cache clean--force</syntaxhighlight>|<syntaxhighlight lang="bash">
</syntaxhighlight>|$|/home/kangkk}}
=== version ===
修复或小的模块逻辑更改。
{{shc|<syntaxhighlight lang="bash">
npm version patch</syntaxhighlight>|$|/home/kangkk}}
功能逻辑变更。
{{shc|<syntaxhighlight lang="bash">
npm version minor</syntaxhighlight>|$|/home/kangkk}}
大版本改动,不再向下兼容。
{{shc|<syntaxhighlight lang="bash">
npm version major</syntaxhighlight>|$|/home/kangkk}}
=== ls ===
查看命令。如查看某组件的版本信息。
{{Shc_out|<syntaxhighlight lang="bash">
npm ls express</syntaxhighlight>|<syntaxhighlight lang="bash">
kangkk-check-imported-file@0.0.6 /Users/kangjian/360/dora/td-deadfile
└── express@4.18.2
</syntaxhighlight>|$|/home/kangkk}}
除此之外还可以通过添加额外的参数检查深度。
{{Shc_out|<syntaxhighlight lang="bash">
npm ls --depth=0</syntaxhighlight>|<syntaxhighlight lang="bash">
kangkk-check-imported-file@0.0.6 /Users/kangjian/360/dora/td-deadfile
├── @semantic-release/changelog@6.0.1
├── @semantic-release/git@10.0.1
...
├── table@5.4.6
├── util@0.12.5
└── yargs@14.2.3
</syntaxhighlight>|$|/home/kangkk}}
== 包升级工具 ==
=== ls ===
{{shc_out|<syntaxhighlight lang="bash">
npm ls vue</syntaxhighlight>|<syntaxhighlight lang="text">
ask-go-pc@1.0.0 /mnt/d/gitee/k/ask-go-pc
├─┬ nuxt@2.14.6
│ ├─┬ @nuxt/builder@2.14.6
│ │ └─┬ @nuxt/vue-app@2.14.6
│ │  └── vue@2.6.12  deduped
│ └─┬ @nuxt/core@2.14.6
│  └─┬ @nuxt/vue-renderer@2.14.6
│    └── vue@2.6.12  deduped
└── vue@2.6.12
</syntaxhighlight>|kangkk@LAPTOP-S5B1JMCV:/mnt/d/gitee/k/ask-go-pc$}}