1.Cannot download "https://github.com/sass/node-sass

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.10.0/linux-x64-72_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.10.0/linux-x64-72_binding.node": 解决:
    yarn
    yarn add node-sass  --dev
    yarn add sass-loader --dev

2.权限问题

-  Building for production...
 ERROR  Error: EACCES: permission denied, rmdir '/var/lib/jenkins/workspace/jentest/dist/vueDemo'
Error: EACCES: permission denied, rmdir '/var/lib/jenkins/workspace/jentest/dist/vueDemo'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-demo@0.1.0 build: `vue-cli-service build`
npm ERR! Exit status 1

解决:

jenkins修改启动用户,解决执行脚本权限问题

     1.将jenkins账号分别加入到root组中

          gpasswd -a root jenkins

    2.修改/etc/sysconfig/jenkins文件中,

            # user id to be invoked as (otherwise will run as root; not wise!)

          JENKINS_USER=root

          JENKINS_GROUP=root 可以修改为root权限运行

   3.重启Jenkins   

         ## service Jenkins restart

附上我jenkins shell脚本以供参考:

#!/bin/sh -li
#echo $PATH
node -v
npm -v
#cnpm -v
source /etc/profile #声明环境变量
export CNPM_HOME=/root/node-v12.3.1-linux-x64/bin
export PATH=$PATH:$CNPM_HOME
#cnpm cache verify #清除缓存
#cnpm install #安装cnpm

cd /var/lib/jenkins/workspace/jentest
#echo '>>> npm run build'
yarn
yarn add node-sass  --dev
yarn add sass-loader --dev
#npm install
npm run build

3.Jenkins部署到远程(Linux服务器)

   解决:

           安装Jenkins 插件:   

                         Publish Over SSH

在SSH Server Name字段选择你的预先配置好的服务器(创建过程: Jenkins -> 系统管理 -> 系统设置 -> Publish over SSH -> SSH Servers,点击新增)

4.SSH 路径相关:

         

source files  源路径为:jinkens workspace的相对路径,切记!

                                       如果是文件加  /**

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐