Angular Azure Devops复制任务无法';在npm任务生成后找不到dist/app文件夹
我正在Azure应用程序服务上部署和安装应用程序。发布管道成功,但应用程序不存在。我查看了wwwroot和LocalSiteRoot,发现dist文件夹不在那里。我的管道错了吗?基于app angular.json,构建将在dist/myapp中生成。但是复制任务找不到它Angular Azure Devops复制任务无法';在npm任务生成后找不到dist/app文件夹,angular,azure,azure-devops,Angular,Azure,Azure Devops,我正在Azure应用程序服务上部署和安装应用程序。发布管道成功,但应用程序不存在。我查看了wwwroot和LocalSiteRoot,发现dist文件夹不在那里。我的管道错了吗?基于app angular.json,构建将在dist/myapp中生成。但是复制任务找不到它 pool: name: Azure Pipelines steps: - task: NodeTool@0 displayName: 'Use Node 6.x' - task: Npm@1 displayNam
pool:
name: Azure Pipelines
steps:
- task: NodeTool@0
displayName: 'Use Node 6.x'
- task: Npm@1
displayName: 'Use npm @latest'
inputs:
command: custom
verbose: false
customCommand: 'install -g npm@latest'
- task: Npm@1
displayName: 'npm install'
inputs:
verbose: false
- task: Npm@0
displayName: 'npm build'
inputs:
cwd: myapp/package.json
command: custom
arguments: 'run prod-build-dev'
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
inputs:
SourceFolder: '$(agent.builddirectory)/dist/myapp'
TargetFolder: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: app'
inputs:
ArtifactName: app
Azure Devops复制任务在npm任务生成后找不到dist/app文件夹
要确保生成将在dist
文件夹中生成,应正确设置package.json
和angular.json
文件
package.json
文件类似于:
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"prod-build-dev": "ng build --prod --build-optimizer",
"prod-build-staging": "ng build --prod --configuration=staging --build-optimizer"
}
并且不要更改angular.json
中的默认outputPath
:
"options": {
"outputPath": "dist",
}
有一个关于的很棒的文档,您可以查看它以了解更多细节
如果上面的内容对您没有帮助,您可以共享您的package.json
和angular.json
文件,以及您问题中关于npm build
任务的构建日志。我会检查的
希望这有帮助