映射纱线构建输出以暂存工件

时间:2019-05-31 17:33:12

标签: azure azure-devops yaml azure-pipelines yarnpkg

我正在尝试使用Azure DevOps yarn YAML任务来构建我的网站。该步骤完成。但是构建的代码在哪里呢?

##[section]Starting: Yarn   
    Task         : Yarn task
Description  : Executes Yarn
Version      : 2.8.1001
Author       : Geek Learning
Help         : [More Information](https://github.com/geeklearningio/gl-vsts-tasks-yarn/wiki/Yarn) (Version 2.8.1001).

Dear Angular and Ember CLI users, please check our [known issues](https://github.com/geeklearningio/gl-vsts-tasks-yarn/wiki/Known-Issues)
==============================================================================
SYSTEMVSSCONNECTION exists true
SYSTEMVSSCONNECTION exists true
    [command]C:\windows\system32\cmd.exe /D /S /C "C:\npm\prefix\yarn.cmd --production build"
yarn install v1.15.2
    [1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.4: The platform "win32" is incompatible with this module.
    info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.
    info fsevents@1.2.7: The platform "win32" is incompatible with this module.
    info "fsevents@1.2.7" is an optional dependency and failed compatibility check. Excluding it from installation.
    [3/4] Linking dependencies...
warning " > bootstrap@4.3.1" has unmet peer dependency "jquery@1.9.1 - 3".
    warning " > bootstrap@4.3.1" has unmet peer dependency "popper.js@^1.14.7".
    [4/4] Building fresh packages...
Done in 119.26s.
##[section]Finishing: Yarn



##[section]Starting: Stage Files
    ==============================================================================
    Task         : Copy Files
Description  : Copy files from source folder to target folder using match patterns (The match patterns will only match file paths, not folder paths)
Version      : 2.117.2
Author       : Microsoft Corporation
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=708389)

##[error]Unhandled: Not found SourceFolder: D:\a\1\a\s\build\
##[section]Finishing: Stage Files

这是我的YAML

task: Yarn@2
inputs:
    ProjectDirectory: './'
Arguments: 'build'
ProductionMode: true

    - task: CopyFiles@2
displayName: 'Stage Files'
inputs:
    SourceFolder: 'D:\_work\1\s\build'
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)/dist'
CleanTargetFolder: true
OverWrite: true      

我一直在玩SourceFolder,但没有运气。

添加“ dir”命令似乎表明我在项目的根文件夹中,但是看不到构建文件夹

2 个答案:

答案 0 :(得分:0)

我认为问题在于“纱线构建”似乎正在起作用,但它仅安装纱线。

在“ yarn --production”之后,我向“ yarn build”添加了第二条命令。

{{MEDIA_URL}}{{object.flyer.url}}

答案 1 :(得分:0)

##[error]Unhandled: Not found SourceFolder: D:\a\1\a\s\build\

根据此消息,我认为由source folder的路径未正确指定引起的错误。

正如我在评论中提到的,此值与您的代理本地路径有关。无论如何,无论代理是什么,都可以使用一个相同的变量来获取它:Build.SourcesDirectory

这是一个predefined variable,可以获取代理程序中下载您的源代码文件的本地路径。

所以,我的建议是:将SourceFolder的值修改为

inputs:
SourceFolder: '$(Build.SourceDirectory)'

获取正确的构建路径。