问题描述
我在将 SSR Nuxt.js 应用从 Azure DevOps Pipelines 部署到 Azure 应用服务时遇到问题.
免责声明:✅我已经使用 Linux 容器设置了 Azure 应用服务.✅我已将此添加到 nuxt.config.js
服务器:{主机:'0.0.0.0'}
在 Azure DevOps Pipelines 中,我在构建后复制这些文件:
.nuxt/**静止的/**包.jsonnuxt.config.js
然后我将它们压缩为 package.zip在日志中,它显示它已成功压缩文件,但是当我解压缩包时,没有任何 .nuxt
文件存在.我也很困惑,由于某种原因在 package.zip 中,它将所有构建文件放在一个名为 a/
您可以在照片中看到它正在顶部创建a"文件夹,并且看起来所有文件都被添加到存档中.当我解压缩 package.zip 时,只有其中的文件是:* 包.json* nuxt.config.js*/静态
这是我的 YAML 文件的样子:
触发器:- 掌握水池:vmImage: 'ubuntu-最新'脚步:- 任务:NodeTool@0输入:版本规范:'12.x'displayName: '安装 Node.js'- 脚本: |cd src/Web.Nuxt安装npm 运行构建displayName: 'npm 安装和构建'- 任务:CopyFiles@2输入:SourceFolder: '$(Build.SourcesDirectory)/src/Web.Nuxt'内容: |.nuxt/**静止的/**包.jsonnuxt.config.js目标文件夹:'$(Build.ArtifactStagingDirectory)'- 任务:ArchiveFiles@2输入:rootFolderOrFile: '$(Build.ArtifactStagingDirectory)'存档类型:'zip'存档文件:'$(Build.ArtifactStagingDirectory)/package.zip'replaceExistingArchive: 真- 任务:PublishBuildArtifacts@1输入:路径发布:'$(Build.ArtifactStagingDirectory)/package.zip'工件名称:'掉落'发布位置:'容器'
如果有任何帮助可以让我重新开始使用 Azure DevOps Pipelines、Azure App Service 和 Nuxt SSR 应用部署 SSR Next.app,我们将不胜感激.这很难解决,因为在 Azure DevOps Pipelines and Releases 中,它说一切都成功了.
这个过程没有问题..nuxt
文件夹只是 Linux 环境中的隐藏文件夹.它隐藏而不是缺失 ~
对于Linux:名称以.(dot)
开头的文件夹被视为一个隐藏文件夹.网上有很多关于这种行为的讨论,你可以试试
I'm having trouble deploying a SSR Nuxt.js app from Azure DevOps Pipelines to Azure App Service.
Disclaimers:✅I have setup an Azure App Service with a Linux container.✅I have added this to nuxt.config.js
server: {
host: '0.0.0.0'
}
In Azure DevOps Pipelines I copy over these files after the build:
.nuxt/**
static/**
package.json
nuxt.config.js
then I zip them up as package.zipin the logs it shows it as successfully zipping the files but when I unzip the package none of the .nuxt
files are present. I'm also confused that for some reason in the package.zip it puts all the build files in a folder named simply a/
You can see in the photo that it's creating the 'a' folder at the top and that it looks like all the files are being added to the archive.When I unzip the package.zip the only files that are in there are: * package.json * nuxt.config.js * /static
this is what my YAML file looks like:
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool@0
inputs:
versionSpec: '12.x'
displayName: 'Install Node.js'
- script: |
cd src/Web.Nuxt
npm install
npm run build
displayName: 'npm install and build'
- task: CopyFiles@2
inputs:
SourceFolder: '$(Build.SourcesDirectory)/src/Web.Nuxt'
Contents: |
.nuxt/**
static/**
package.json
nuxt.config.js
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)'
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/package.zip'
replaceExistingArchive: true
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/package.zip'
ArtifactName: 'drop'
publishLocation: 'Container'
Any help would be greatly appreciated that can set me back on course to deploying a SSR Next.app with Azure DevOps Pipelines, Azure App Service, and a Nuxt SSR app. This has been tough to troubleshoot because in Azure DevOps Pipelines and Releases it says that everything was a success.
Nothing wrong with this process. The .nuxt
folder is just hidden folder in Linux environment. It's hidden instead of missing ~
For Linux: The folder whose name starts with .(dot)
is considered as one hidden folder. There's many discussions online about this behavior, you can try this one.
If you download that package.zip
file and unzip it in Windows environment, you can easily find the .nuxt
folder:
这篇关于通过 Azure DevOps Pipelines 将 Nuxt.js SSR 应用部署到 Azure 应用服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!