小技巧
因為每次執行 npm adduser
的時候都需要輸入用戶名、密碼和email 很麻煩,我們都可以配置在.npmrc 文件中,在命令行中執行如下腳本
echo -n 'myuser:mypassword' | openssl base64
會得到一個 base64 的字符串
然后再通過 _auth 進行授權認證 @test:registry 指向的是自建的npm源
registry=https://registry.npm.taobao.org
@test:registry=http://npm.test.net
_auth=YmFvYmFvOmJhb2Jhbw===
實際項目.npmrc 設置,指定某個包為私有鏡像源:
