对于 SPA 应用程序,我遵循了此文档https://nuxtjs.org/faq/netlify-deployment/ 。这是我的配置: 部署设置
当我在npm run build
本地对我的 Nuxt 项目进行操作时,一切正常,并且.nuxt
包含的文件夹dist
也会生成,但是,在 Netlify 中它将无法正常工作。这是在“构建站点”阶段失败的主要问题的部署日志:部署目录“dist”不存在。在这里,我将粘贴完整的日志:
3:52:58 PM: build-image version: 9cade8af58c2cf3a17a1e9433d2e979149488837
3:52:58 PM: build-image tag: v3.3.5
3:52:58 PM: buildbot version: 2d05064ce3dd2eb95d282a24602ab707dd9581e8
3:52:58 PM: Fetching cached dependencies
3:52:58 PM: Starting to download cache of 212.5MB
3:52:59 PM: Finished downloading cache in 1.384846269s
3:52:59 PM: Starting to extract cache
3:53:09 PM: Finished extracting cache in 10.185000282s
3:53:10 PM: Finished fetching cache in 11.702997628s
3:53:10 PM: Starting to prepare the repo for build
3:53:10 PM: Preparing Git Reference refs/heads/master
3:53:11 PM: Starting build script
3:53:11 PM: Installing dependencies
3:53:13 PM: Started restoring cached node version
3:53:16 PM: Finished restoring cached node version
3:53:17 PM: v10.18.0 is already installed.
3:53:19 PM: Now using node v10.18.0 (npm v6.13.4)
3:53:19 PM: Attempting ruby version 2.6.2, read from environment
3:53:21 PM: Using ruby version 2.6.2
3:53:21 PM: Using PHP version 5.6
3:53:21 PM: Started restoring cached node modules
3:53:21 PM: Finished restoring cached node modules
3:53:22 PM: Started restoring cached go cache
3:53:22 PM: Finished restoring cached go cache
3:53:22 PM: unset GOOS;
3:53:22 PM: unset GOARCH;
3:53:22 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
3:53:22 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
3:53:22 PM: go version >&2;
3:53:22 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
3:53:22 PM: go version go1.12 linux/amd64
3:53:22 PM: Installing missing commands
3:53:22 PM: Verify run directory
3:53:22 PM: Executing user command: npm run build
3:53:22 PM: > marketplace@1.0.0 build /opt/build/repo
3:53:22 PM: > nuxt build
3:53:24 PM: ℹ Production build
3:53:24 PM: ✔ Builder initialized
3:53:24 PM: ✔ Nuxt files generated
3:53:25 PM: ℹ Compiling Client
3:53:42 PM: ✔ Client: Compiled successfully in 17.17s
3:53:42 PM: ℹ Compiling Server
3:53:48 PM: ✔ Server: Compiled successfully in 5.39s
3:53:48 PM: Hash: 68bf0ef29d3fb5c8e150
3:53:48 PM: Version: webpack 4.41.5
3:53:48 PM: Time: 17174ms
3:53:48 PM: Built at: 01/05/2020 8:53:42 PM
3:53:48 PM: Asset Size Chunks Chunk Names
3:53:48 PM: ../server/client.manifest.json 28.2 KiB [emitted]
3:53:48 PM: 052eb8747a05f1304a0a.js 4.38 KiB 5 [emitted] [immutable] pages/Marketplace/_id
3:53:48 PM: 05acc90986191e1ad517.js 264 bytes 9 [emitted] [immutable] pages/Sso/index
3:53:48 PM: 2ab3d6553077491b19d2.js 4.74 KiB 8 [emitted] [immutable] pages/Sso/_token
3:53:48 PM: 3664b44a9c9732b7d2e0.js 32.4 KiB 13 [emitted] [immutable] vendors.app
3:53:48 PM: 4b9707aba77b0333f36b.js 163 KiB 2 [emitted] [immutable] commons.app
3:53:48 PM: 5488203ab0561699ec41.js 17 KiB 11 [emitted] [immutable] pages/index
3:53:48 PM: 619f0bd9f2a9459ad28a.js 264 bytes 7 [emitted] [immutable] pages/Pricing/index
3:53:48 PM: 65dc97af8f4b0160ebf2.js 265 bytes 10 [emitted] [immutable] pages/Tools/index
3:53:48 PM: 80fa73e83c4cec08f53b.js 60.1 KiB 1 [emitted] [immutable] app
3:53:48 PM: LICENSES 876 bytes [emitted]
3:53:48 PM: af478362505be97ffe5e.js 8.57 KiB 6 [emitted] [immutable] pages/Marketplace/index
3:53:48 PM: bc2f7cdf3afe2ac74b48.js 264 bytes 3 [emitted] [immutable] pages/Contact/index
3:53:48 PM: c14d23663ea237774ac6.js 10.7 KiB 4 [emitted] [immutable] pages/Marketplace/Requested/_id
3:53:48 PM: ca77d1bfd2f5f229c948.js 54.5 KiB 0 [emitted] [immutable] vendors.pages/Marketplace/Requested/_id.pages/Marketplace/index.pages/index
3:53:48 PM: e8d8275edcf2097334df.js 2.53 KiB 12 [emitted] [immutable] runtime
3:53:48 PM: fonts/066dc24.woff 34.1 KiB [emitted]
3:53:48 PM: failed during stage 'building site': Deploy directory 'dist' does not exist
3:53:48 PM: fonts/0a4b5c5.woff2 27.8 KiB [emitted]
3:53:48 PM: fonts/1af04b3.woff 35.8 KiB [emitted]
3:53:48 PM: fonts/3650a3f.woff2 25.9 KiB [emitted]
3:53:48 PM: fonts/4f07e73.woff 33.8 KiB [emitted]
3:53:48 PM: fonts/5b8b69a.woff 33.9 KiB [emitted]
3:53:48 PM: Shutting down logging, 46 messages pending
3:53:48 PM: fonts/6cbb85d.woff2 25.9 KiB [emitted]
3:53:48 PM: fonts/807f943.woff 32.8 KiB [emitted]
如果有人可以帮助我,我将不胜感激!