npm link
在发布 npm 包前最好进行本地测试
npm link
将需要被测试的包软连接到全局 nmp 中
全局 nmp 的位置可以通过 npm config ls -l
来查看

Preview
或者通过 npm root -g
来查看
1 将包 npm-test-zbx 软连接到全局 npm 中
sh
cd npm-test-zbx
npm link

Preview

Preview
2 在项目 test 中使用 npm-test-zbx
sh
cd test
npm link npm-test-zbx

Preview
3 从项目 test 中卸载 npm-test-zbx
sh
cd test
npm unlink npm-test-zbx

Preview
4 将包 npm-test-zbx 从全局 npm 中卸载
sh
cd npm-test-zbx
npm unlink