柚子快報激活碼778899分享:yarn 上傳前端node
柚子快報激活碼778899分享:yarn 上傳前端node
一、構(gòu)建項目依賴鏡像
1、安裝yarn
npm install -g yarn
2、先我們需要設(shè)置?個?錄作為我們的“離線鏡像”存儲,我們可以通過yarn config 命令來實現(xiàn)。
默認在C盤中 C:\Users\Admin\npm-packages-offline-cache下,之后會在當前項?路徑?成?個npm-packages-offline-cache 文件夾用來存放構(gòu)建的.tgz離線?件
yarn config set yarn-offline-mirror ./npm-packages-offline-cache
3、移動配置文件到項目路徑,以便離線鏡像僅用于此項目。
mv ~/.yarnrc ./
4、刪除之前的node_modules和yarn.lock并重新構(gòu)建
rm -rf node_modules/ yarn.lock
yarn install
二、上傳鏡像制Nexus依賴庫
1、連接服務(wù)器,創(chuàng)建上傳目錄。
cd /home
makir npm
cd /npm
2、上傳node_modules依賴包,并解壓到當前目錄下。
unzip node_modules.zip
cd node_modules
3、授權(quán)并登錄Nexus。
chmod a+x uploadUpmOffline.sh
npm login -u admin -p admin --registry=http://192.168.100.100:8080/repository/npm-test/
4、執(zhí)行上傳腳本,上傳node_modules鏡像
#!/bin/bash
for file in $(ls /home/npm/node_modules)
do
if [ "${file##*.}" = "tgz" ]; then
npm publish /home/npm/node_modules/$file --registry=http://192.168.100.100:8080/repository/npm-test/
fi
done
./uploadUpmOffline.sh
柚子快報激活碼778899分享:yarn 上傳前端node
好文推薦
本文內(nèi)容根據(jù)網(wǎng)絡(luò)資料整理,出于傳遞更多信息之目的,不代表金鑰匙跨境贊同其觀點和立場。
轉(zhuǎn)載請注明,如有侵權(quán),聯(lián)系刪除。