如何在具有纱线的vsts中创建react build管道。找不到package.json

时间:2018-08-10 08:39:27

标签: reactjs msbuild azure-devops yarnpkg

我有一个React项目,在本地我只使用纱线安装,纱线构建和纱线开始在https://localhost:3000进行测试

我有以下管道: enter image description here

但是我的日志中有此错误:

2018-08-10T08:31:34.6206910Z ##[section]Starting: Yarn build
2018-08-10T08:31:34.6211162Z ==============================================================================
2018-08-10T08:31:34.6211307Z Task         : Yarn task
2018-08-10T08:31:34.6211411Z Description  : Executes Yarn
2018-08-10T08:31:34.6211531Z Version      : 2.5.999
2018-08-10T08:31:34.6211633Z Author       : Geek Learning
2018-08-10T08:31:34.6211842Z Help         : [More Information](https://github.com/geeklearningio/gl-vsts-tasks-yarn/wiki/Yarn) (Version 2.5.999).

Dear Angular and Ember CLI users, please check our [known issues](https://github.com/geeklearningio/gl-vsts-tasks-yarn/wiki/Known-Issues)
2018-08-10T08:31:34.6212057Z ==============================================================================
2018-08-10T08:31:35.2261051Z [command]C:\Windows\system32\cmd.exe /D /S /C "C:\hostedtoolcache\windows\yarn\1.9.4\x64\yarn-v1.9.4\bin\yarn.cmd build"
2018-08-10T08:31:42.0864621Z yarn run v1.9.4
2018-08-10T08:31:42.1571684Z error Couldn't find a package.json file in "C:\\"
2018-08-10T08:31:42.1572901Z info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
2018-08-10T08:31:42.1822978Z ##[error]Error: C:\hostedtoolcache\windows\yarn\1.9.4\x64\yarn-v1.9.4\bin\yarn.cmd failed with return code: 1
2018-08-10T08:31:42.1893252Z ##[section]Finishing: Yarn build

但是实际上有一个package.json

enter image description here

2 个答案:

答案 0 :(得分:0)

很抱歉,您正在为此苦苦挣扎。在您的情况下,应将路径保留为空,它默认为源存储库。

答案 1 :(得分:0)

我要做的是存档构建结果

enter image description here

然后从发布管道中获取该zip文件:

enter image description here

不确定这是否是最佳做法,但对我有用。