一 、注册cnpm 报错
报错配置
rm -rf ${WORKSPACE}/${JOB_NAME}.tar.gz
alias cnpm="npm --registry=https://registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=https://npm.taobao.org/dist \
--userconfig=$HOME/.cnpmrc"
SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass/ cnpm install
npm run build
tar -zcvf /tmp/${JOB_NAME}.tar.gz -C ${WORKSPACE}/dist/ .
mv /tmp/${JOB_NAME}.tar.gz ${WORKSPACE}/
cp ${WORKSPACE}/${JOB_NAME}.tar.gz ${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_NUMBER}.tar.gz
服务器上已经安装cnpm了,删除以下配置
alias cnpm="npm --registry=https://registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=https://npm.taobao.org/dist \
--userconfig=$HOME/.cnpmrc"
SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass/
最终配置
rm -rf ${WORKSPACE}/${JOB_NAME}.tar.gz
cnpm install
npm run build
tar -zcvf /tmp/${JOB_NAME}.tar.gz -C ${WORKSPACE}/dist/ .
mv /tmp/${JOB_NAME}.tar.gz ${WORKSPACE}/
cp ${WORKSPACE}/${JOB_NAME}.tar.gz ${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_NUMBER}.tar.gz
正常运行 😊
其实之前一直在正常运行,某一天在构建的时候突然就不行了,原因暂时未找到
二 、执行npm install 报错,安装某个包的时候,下载超时总是(下载不下来)
背景:之前一直没问题,然后突然有一天就不能安装(ElementUI/theme-default)了
报错内容:unable to access '[https://github.com/ElementUI/theme-default.git/](https://github.com/ElementUI/theme-default.git/)': Failed to connect to github.com port 443: Connection timed ou
报错配置:
查看package.json文件
"element-theme-default": "https://github.com/ElementUI/theme-default"
改成:
"element-theme-default": "^1.4.3"