1.已将this GitHub存储库导入Azure存储库。
1.使用经典编辑器创建了构建管道,其YAML代码如下:
trigger:
branches:
include:
- refs/heads/master
jobs:
- job: Job_1
displayName: Agent job 1
pool:
vmImage: ubuntu-latest
steps:
- checkout: self
fetchDepth: 1
- task: Npm@1
displayName: npm install
inputs:
workingDir: package.json
verbose: false
- task: Npm@1
displayName: npm custom
inputs:
command: custom
workingDir: package.json
verbose: false
customCommand: npm run build
- task: ArchiveFiles@2
displayName: Archive $(Build.BinariesDirectory)
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
字符串
不确定,出了什么问题。运行管道时,npm install
步骤中出现错误:
的数据
文本错误:
Starting: npm install
==============================================================================
Task : npm
Description : Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Azure Artifacts.
Version : 1.221.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/package/npm
==============================================================================
/usr/local/bin/npm --version
9.5.1
##[error]Error: ENOTDIR: not a directory, stat '/home/vsts/work/1/s/package.json/.npmrc'
型
1条答案
按热度按时间pxy2qtax1#
为了让你的YAML管道从你的存储库中读取代码,你需要使用predefined variables为了从存储库中读取你的文件,你需要在你的代码中使用
$(System.DefaultWorkingDirectory)
。当我尝试使用package.json甚至$(System.DefaultWorkingDirectory)/package.json时,我收到了相同的错误代码:
x1c 0d1x的数据
现在,我使用下面的代码-1和它的工作成功,参考下面:-
字符串
输出:-
的
代码-2:-
型
输出:-
的