赵走x博客
网站访问量:151461
首页
书籍
软件
工具
古诗词
搜索
登录
12、Ubuntu安装Jenkins(不使用docker)
11、jenkins日志查看方法
10、jenkins为root权限
9、系统用户切换到jenkins
8、ubuntu安装jenkins
7、taro: command not found
6、修改Ubuntu下的jenkins的默认端口号
5、jenkins.plugins.publish_over.BapPublisherException
4、mac安装jenkins
3、jenkins重启方式
2、Jenkins构建时的java.nio.file.AccessDeniedException
1、jenkins 部署错误 cannot open .git/FETCH_HEAD: Permission denied 解决办法
7、taro: command not found
资源编号:76481
jenkins
微服务
热度:226
本地自动打包taro项目然后发不到服务器
### 问题说明 本地打包taro发布到服务器,命令是: ``` # 构建 taro build --type h5 # 上传 scp -r ./dist root@XX.XX.XX.XX:/XX ``` 本地运行这些命令可以正常打包上传,放到jenkins上时,报错: ``` script.sh: line 2: taro: command not found ``` ### 网上提供的解决方案 本机shell命令可以执行,jenkins任务中无法执行,则是jenkins没有加载/etc/profile导致,需要在jenkins调用shell脚本的最前面加一行脚本,#!/bin/bash -ilex,可以通过-i参数和-l参数让bash为login shell and interactive shell,就可以读取/etc/profile和~/.bash_profile等文件 ``` #!/bin/bash -ilex ``` ssh命令中可以直接添加 source /etc/profile ``` ssh xxx@xxxx 'source /etc/profile; cd ...' ``` ### 最终解决方案: ``` #!/bin/bash -ilex cd /Users/mark/BB/bb_mobile taro build --type h5 scp -r ./dist root@XX.XX.XX.XX:/XX ``` 翻译成jenkins流水线脚本: ``` sh label: '', script: '''#!/bin/bash -ilex cd /Users/mark/BB/bb_mobile taro build --type h5 scp -r ./dist root@XX.XX.XX.XX:/XX''' ``` 再次运行,成功!