【发布时间】:2026-02-07 07:20:06
【问题描述】:
基于this Nuxt docs page,一旦我运行yarn build,然后“Nuxt.js 将创建一个 .nuxt 目录,其中所有内容都准备好部署在您的服务器托管上。”
基于fewotherwalkthroughs,还有一些其他必填项:static/**、package.json 和nuxt.config.js。
其中一篇文章以及Nuxt page for deploying to Azure using IIS 上的说明说,server.js 文件是必需的,但我想坚持“内部所有东西都可以部署”。我的 Azure 应用服务是针对 Linux 而不是 IIS 设置的。
然而,在我部署这些文件/文件夹后,npm run start(映射到 nuxt start)会引发错误,即 nuxt 不是可识别的命令。这是有道理的,因为我还没有安装软件包。
我还尝试使用node .nuxt/server.js 和node .nuxt/dist/server/server.js 启动ssr 应用程序。这些都不起作用。
我真的很想坚持“Nuxt.js 将创建一个 .nuxt 目录,其中所有内容都准备好部署在您的服务器托管上”,而不是在部署后复制 node_modules 或必须 npm install。
我在这里遗漏了哪些文件或命令,这甚至可能吗?
- 节点版本为 14.16
- Nuxt 版本是 2.15.3 版的全新安装
nuxt.config.js
export default {
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
title: "test-nuxt-app",
htmlAttrs: {
lang: "en"
},
meta: [
{ charset: "utf-8" },
{ name: "viewport", content: "width=device-width, initial-scale=1" },
{ hid: "description", name: "description", content: "" }
],
link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }]
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: [],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [],
// Auto import components: https://go.nuxtjs.dev/config-components
components: true,
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [],
// Modules: https://go.nuxtjs.dev/config-modules
modules: [],
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {}
};
【问题讨论】:
-
嗨,我的回答有帮助吗?
-
对不起,没有。我已经知道你提到的一切。
-
您根本没有提供任何反馈。祝你的问题好运。
标签: azure vue.js deployment nuxt.js server-side-rendering