常用命令

registry

1
2
3
$ npm config get registry
$ npm config set registry https://registry.npmjs.org/
$ npm config set registry https://registry.npm.taobao.org/

cache

1
npm cache clean --force

node-gyp

1
2
3
4
5
+-- node-gyp@9.3.1
+-- npm@8.1.0
+-- windows-build-tools@5.2.2

node=== 16.13.0
1
2
$ npm install -g windows-build-tools
$ npm install -g node-gyp

image-20230404123721882

image-20230404123947930

image-20230404134123694

  • 报错 MSBuild.exe` failed with exit code: 1
    • 安装sharp等包时 编译失败大部分是因为node版本问题编译失败
    • 删除node_moudels、package-lock.json、重装node-gyp,再重试安装

NRM

1
$ npm install -g nrm open@8.4.2 --save