问题
I created a basic vue.js with Visual studio 2019. I put it on a git in my private azure server. I have a windows build agent.
yml for building, no error.
trigger:
- master
pool: 'Default'
- script: |
npm install
npm run build
displayName: 'npm install and build'
I tried somes "copy/archive files" commands. One of them
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)/VuejsApp1'
inputs:
TargetFolder: '$(Build.ArtifactStagingDirectory)/VuejsApp1'
Every method seems to show that the dist folder is never created.
similar question : why is azure build pipeline not generating a dist folder for an angular build
##[section]Starting: npm install and build ============================================================================== Task : Command line Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows Version : 2.151.1 Author : Microsoft Corporation Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line ============================================================================== Generating script. ========================== Starting Command Output =========================== ##[command]"C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "C:\DevOpsAgent_work_temp\2d81f910-5c00-4330-9d13-27c8c30aa7a0.cmd""
yorkie@2.0.0 install C:\DevOpsAgent_work\171\s\node_modules\yorkie node bin/install.js
CI detected, skipping Git hooks installation
core-js@2.6.11 postinstall C:\DevOpsAgent_work\171\s\node_modules\core-js node -e "try{require('./postinstall')}catch(e){}"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: > https://opencollective.com/core-js > https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
ejs@2.7.4 postinstall C:\DevOpsAgent_work\171\s\node_modules\ejs node ./postinstall.js
Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
added 1488 packages from 822 contributors and audited 1492 packages in 71.233s
44 packages are looking for funding run
npm fund
for detailsfound 6 vulnerabilities (1 low, 3 moderate, 2 high) run
npm audit fix
to fix them, ornpm audit
for details ##[section]Finishing: npm install and build
回答1:
First, you need to NOT do install and build on the same "script".
- script: 'npm install'
displayName: 'Install dependencies'
- script: 'npm run build'
displayName: 'Build project'
after that, you can get the dist folder
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
inputs:
SourceFolder: '$(Build.SourcesDirectory)/dist'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
回答2:
There are two troubleshooting advice:
1.Try to build locally, or run the npm command using the PowerShell task of Azure DevOps to see if the same issue exists.
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
npm install
npm run build
2.Check if the options
parameter in your json file is set to dist
.
"options": {
"outputPath": "dist",
}
来源:https://stackoverflow.com/questions/65225273/dist-folder-on-basic-vue-js