V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
richzhu
V2EX  ›  Node.js

Jenkins 运行 yarn build 失败,但是手动登录到服务器就成功

  •  
  •   richzhu · 2021-12-14 16:15:54 +08:00 · 3886 次点击
    这是一个创建于 835 天前的主题,其中的信息可能已经有所发展或是发生改变。

    各位大佬好,遇到了一个神奇的问题,我利用 jenkins 拉下来项目代码后,直接 ssh 登录到 jenkins 服务器上执行 yarn install yarn build 就没有什么问题,如果把这两条命令,放到 jenkins 的 shell 中,就会报错,而且没有错误日志,只是返回了一个

    error Command failed with exit code 1.
    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
    Build step 'Execute shell' marked build as failure
    Finished: FAILURE
    

    求各位大佬指点一下 要怎么解决这个问题,非常感谢 😄

    CodeCodeStudy
        1
    CodeCodeStudy  
       2021-12-14 16:26:23 +08:00
    你 ssh 登录的是什么用户?用什么用户运行的 jenkins ?
    richzhu
        2
    richzhu  
    OP
       2021-12-14 16:32:52 +08:00
    大佬好,感谢回帖,我解决了,是因为缺少一条 CI=false 的环境变量,加上后就成功了😄 不加这条环境变量的话,warning 会被 shell 识别成 error
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   955 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 21:24 · PVG 05:24 · LAX 14:24 · JFK 17:24
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.