Home
Support Forums

[Build error] Publish + Swift , personal blog

I’m using Publish(a static site generator written in Swift) to create my blog site. And it builds ok and deployed successfully on netlify host. But when I apply a custom theme && CSS styles and re-deploy it, it returned errors.

For me it is weird. First build is successful and site is worked in localhost. And about those errors, the lines of code mentioned in log is not changed comparing to default theme file. So I have no clue where is wrong. Please help to check on below logs.

Build Logs:

10:07:02 PM: Build ready to start
10:07:05 PM: build-image version: 0582042f4fc261adc7bd8333f34884959c577302
10:07:05 PM: build-image tag: v3.7.6
10:07:05 PM: buildbot version: 3352c8b27c9ddee0301e494de800235be05ef095
10:07:05 PM: Fetching cached dependencies
10:07:05 PM: Starting to download cache of 458.7MB
10:07:08 PM: Finished downloading cache in 2.757940487s
10:07:08 PM: Starting to extract cache
10:07:20 PM: Finished extracting cache in 11.715053422s
10:07:20 PM: Finished fetching cache in 14.553933359s
10:07:20 PM: Starting to prepare the repo for build
10:07:20 PM: Preparing Git Reference refs/heads/master
10:07:21 PM: Parsing package.json dependencies
10:07:22 PM: Starting build script
10:07:22 PM: Installing dependencies
10:07:22 PM: Python version set to 2.7
10:07:22 PM: Started restoring cached node version
10:07:24 PM: Finished restoring cached node version
10:07:25 PM: v12.18.0 is already installed.
10:07:25 PM: Now using node v12.18.0 (npm v6.14.4)
10:07:25 PM: Started restoring cached build plugins
10:07:25 PM: Finished restoring cached build plugins
10:07:25 PM: Attempting ruby version 2.7.1, read from environment
10:07:26 PM: Using ruby version 2.7.1
10:07:27 PM: Using PHP version 5.6
10:07:27 PM: Started restoring cached Swift version
10:07:28 PM: Finished restoring cached Swift version
10:07:28 PM: 5.2 is already installed.
10:07:28 PM: Using Swift version 5.2
10:07:28 PM: Building Swift Package
10:07:28 PM: Started restoring cached swift build
10:07:28 PM: Finished restoring cached swift build
10:07:31 PM: Updating https://github.com/johnsundell/files.git
10:07:31 PM: Updating https://github.com/johnsundell/ink.git
10:07:32 PM: Fetching https://github.com/johnsundell/splashpublishplugin
10:07:32 PM: Updating https://github.com/johnsundell/sweep.git
10:07:33 PM: Updating https://github.com/johnsundell/publish.git
10:07:33 PM: Updating https://github.com/johnsundell/plot.git
10:07:34 PM: Updating https://github.com/johnsundell/shellout.git
10:07:34 PM: Fetching https://github.com/johnsundell/splash.git
10:07:35 PM: Updating https://github.com/johnsundell/codextended.git
10:07:40 PM: Cloning https://github.com/johnsundell/splash.git
10:07:40 PM: Resolving https://github.com/johnsundell/splash.git at 0.15.0
10:07:41 PM: Cloning https://github.com/johnsundell/splashpublishplugin
10:07:41 PM: Resolving https://github.com/johnsundell/splashpublishplugin at 0.1.0
10:07:42 PM: [1/22] Merging module Files
10:07:42 PM: [2/27] Merging module Codextended
10:07:42 PM: [3/27] Wrapping AST for Files for debugging
10:07:42 PM: [4/27] Merging module Sweep
10:07:42 PM: [5/31] Wrapping AST for Codextended for debugging
10:07:42 PM: [6/31] Wrapping AST for Sweep for debugging
10:07:43 PM: [7/36] Merging module ShellOut
10:07:43 PM: [8/41] Compiling Splash Font.swift
10:07:43 PM: [9/41] Compiling Splash Theme+Defaults.swift
10:07:43 PM: [10/41] Compiling Splash Theme.swift
10:07:43 PM: [11/41] Wrapping AST for ShellOut for debugging
10:07:43 PM: [12/41] Compiling Splash CharacterSet+Contains.swift
10:07:43 PM: [13/41] Compiling Splash Equatable+AnyOf.swift
10:07:43 PM: [14/41] Compiling Splash Int+IsOdd.swift
10:07:43 PM: [15/41] Compiling Splash Sequence+AnyOf.swift
10:07:43 PM: [16/42] Compiling Splash String+Removing.swift
10:07:43 PM: [17/42] Compiling Splash Substring+HasSuffix.swift
10:07:43 PM: [18/42] Compiling Splash Grammar.swift
10:07:44 PM: [19/42] Merging module Ink
10:07:44 PM: [20/42] Compiling Splash MarkdownDecorator.swift
10:07:44 PM: [21/42] Compiling Splash OutputBuilder.swift
10:07:44 PM: [22/42] Compiling Splash OutputFormat.swift
10:07:44 PM: [23/42] Wrapping AST for Ink for debugging
10:07:44 PM: [24/42] Compiling Splash SyntaxHighlighter.swift
10:07:44 PM: [25/42] Compiling Splash SyntaxRule.swift
10:07:44 PM: [26/42] Compiling Splash Color.swift
10:07:44 PM: [27/42] Compiling Splash Sequence+Occurrences.swift
10:07:44 PM: [28/42] Compiling Splash String+HTMLEntities.swift
10:07:44 PM: [29/42] Compiling Splash String+IsNumber.swift
10:07:44 PM: [30/42] Compiling Splash String+PrefixChecking.swift
10:07:44 PM: [31/43] Merging module Plot
10:07:44 PM: [32/43] Wrapping AST for Plot for debugging
10:07:44 PM: [33/43] Compiling Splash Segment.swift
10:07:44 PM: [34/43] Compiling Splash TokenType.swift
10:07:44 PM: [35/43] Compiling Splash Tokenizer.swift
10:07:44 PM: [36/43] Compiling Splash SwiftGrammar.swift
10:07:44 PM: [37/43] Compiling Splash AttributedStringOutputFormat.swift
10:07:44 PM: [38/43] Compiling Splash HTMLOutputFormat.swift
10:07:45 PM: [39/44] Merging module Splash
10:07:45 PM: [40/44] Wrapping AST for Splash for debugging
10:07:45 PM: [41/45] Merging module Publish
10:07:45 PM: [42/46] Wrapping AST for Publish for debugging
10:07:45 PM: [43/46] Compiling SplashPublishPlugin SplashPublishPlugin.swift
10:07:45 PM: [44/47] Merging module SplashPublishPlugin
10:07:45 PM: [45/48] Wrapping AST for SplashPublishPlugin for debugging
10:07:45 PM: [46/49] Compiling MyBlog Theme+Basic.swift
10:07:45 PM: /opt/build/repo/Sources/MyBlog/Theme+Basic.swift:168:36: error: use of undeclared type 'ContentProvider'
10:07:45 PM:     @ComponentBuilder var content: ContentProvider
10:07:45 PM:                                    ^~~~~~~~~~~~~~~
10:07:45 PM: /opt/build/repo/Sources/MyBlog/Theme+Basic.swift:168:5: error: unknown attribute 'ComponentBuilder'
10:07:45 PM:     @ComponentBuilder var content: ContentProvider
10:07:45 PM:     ^
10:07:45 PM: /opt/build/repo/Sources/MyBlog/Theme+Basic.swift:170:15: error: use of undeclared type 'Component'
10:07:45 PM:     var body: Component {
10:07:45 PM:               ^~~~~~~~~
10:07:45 PM: /opt/build/repo/Sources/MyBlog/Theme+Basic.swift:167:25: error: use of undeclared type 'ComponentContainer'
10:07:45 PM: private struct Wrapper: ComponentContainer {
10:07:45 PM:                         ^~~~~~~~~~~~~~~~~~
10:07:45 PM: /opt/build/repo/Sources/MyBlog/Theme+Basic.swift:179:15: error: use of undeclared type 'Component'
10:07:45 PM:     var body: Component {
10:07:45 PM:               ^~~~~~~~~
10:07:45 PM: /opt/build/repo/Sources/MyBlog/Theme+Basic.swift:194:29: error: use of undeclared type 'Component'
10:07:45 PM:     private var navigation: Component {
10:07:45 PM:                             ^~~~~~~~~
10:07:45 PM: /opt/build/repo/Sources/MyBlog/Theme+Basic.swift:175:43: error: use of undeclared type 'Component'
10:07:45 PM: private struct SiteHeader<Site: Website>: Component {
10:07:45 PM:                                           ^~~~~~~~~
10:07:45 PM: /opt/build/repo/Sources/MyBlog/Theme+Basic.swift:212:15: error: use of undeclared type 'Component'
10:07:45 PM:     var body: Component {
10:07:45 PM:               ^~~~~~~~~
10:07:45 PM: /opt/build/repo/Sources/MyBlog/Theme+Basic.swift:208:41: error: use of undeclared type 'Component'
10:07:45 PM: private struct ItemList<Site: Website>: Component {
10:07:45 PM:                                         ^~~~~~~~~
10:07:45 PM: /opt/build/repo/Sources/MyBlog/Theme+Basic.swift:229:15: error: use of undeclared type 'Component'
10:07:45 PM:     var body: Component {
10:07:45 PM:               ^~~~~~~~~
10:07:45 PM: /opt/build/repo/Sources/MyBlog/Theme+Basic.swift:225:44: error: use of undeclared type 'Component'
10:07:45 PM: private struct ItemTagList<Site: Website>: Component {
10:07:45 PM:                                            ^~~~~~~~~
10:07:45 PM: /opt/build/repo/Sources/MyBlog/Theme+Basic.swift:238:15: error: use of undeclared type 'Component'
10:07:45 PM:     var body: Component {
10:07:45 PM:               ^~~~~~~~~
10:07:45 PM: /opt/build/repo/Sources/MyBlog/Theme+Basic.swift:237:28: error: use of undeclared type 'Component'
10:07:45 PM: private struct SiteFooter: Component {
10:07:45 PM:                            ^~~~~~~~~
10:07:45 PM: /opt/build/repo/Sources/MyBlog/Theme+Basic.swift:39:19: error: trailing closure passed to parameter of type 'Node<HTML.BodyContext>' that does not accept a closure
10:07:45 PM:             .body {
10:07:45 PM:                   ^
10:07:45 PM: /opt/build/repo/.build/checkouts/plot/Sources/Plot/API/HTMLElements.swift:54:17: note: 'body' declared here
10:07:45 PM:     static func body(_ nodes: Node<HTML.BodyContext>...) -> Node {
10:07:45 PM:                 ^
10:07:45 PM: /opt/build/repo/Sources/MyBlog/Theme+Basic.swift:64:19: error: trailing closure passed to parameter of type 'Node<HTML.BodyContext>' that does not accept a closure
10:07:45 PM:             .body {
10:07:45 PM:                   ^
10:07:45 PM: /opt/build/repo/.build/checkouts/plot/Sources/Plot/API/HTMLElements.swift:54:17: note: 'body' declared here
10:07:45 PM:     static func body(_ nodes: Node<HTML.BodyContext>...) -> Node {
10:07:45 PM:                 ^
10:07:45 PM: /opt/build/repo/Sources/MyBlog/Theme+Basic.swift:82:18: error: type 'Node<HTML.BodyContext>' has no member 'components'
10:07:45 PM:                 .components {
10:07:45 PM:                 ~^~~~~~~~~~~~
10:07:46 PM: Creating deploy upload records
10:07:45 PM: /opt/build/repo/Sources/MyBlog/Theme+Basic.swift:102:19: error: trailing closure passed to parameter of type 'Node<HTML.BodyContext>' that does not accept a closure
10:07:45 PM:             .body {
10:07:45 PM:                   ^
10:07:45 PM: /opt/build/repo/.build/checkouts/plot/Sources/Plot/API/HTMLElements.swift:54:17: note: 'body' declared here
10:07:45 PM:     static func body(_ nodes: Node<HTML.BodyContext>...) -> Node {
10:07:45 PM:                 ^
10:07:45 PM: /opt/build/repo/Sources/MyBlog/Theme+Basic.swift:115:19: error: trailing closure passed to parameter of type 'Node<HTML.BodyContext>' that does not accept a closure
10:07:45 PM:             .body {
10:07:45 PM:                   ^
10:07:45 PM: /opt/build/repo/.build/checkouts/plot/Sources/Plot/API/HTMLElements.swift:54:17: note: 'body' declared here
10:07:45 PM:     static func body(_ nodes: Node<HTML.BodyContext>...) -> Node {
10:07:45 PM:                 ^
10:07:45 PM: /opt/build/repo/Sources/MyBlog/Theme+Basic.swift:139:19: error: trailing closure passed to parameter of type 'Node<HTML.BodyContext>' that does not accept a closure
10:07:45 PM:             .body {
10:07:45 PM:                   ^
10:07:45 PM: /opt/build/repo/.build/checkouts/plot/Sources/Plot/API/HTMLElements.swift:54:17: note: 'body' declared here
10:07:45 PM:     static func body(_ nodes: Node<HTML.BodyContext>...) -> Node {
10:07:46 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1
10:07:45 PM:                 ^
10:07:45 PM: [47/49] Compiling MyBlog main.swift
10:07:45 PM: Error building Swift package
10:07:45 PM: Build was terminated: Build script returned non-zero exit code: 1
10:07:46 PM: Failing build: Failed to build site
10:07:46 PM: Finished processing build request in 40.731255267s

Build Setting:

REPLY

Hi there, @HaiboZhou :wave:

Welcome to the Netlify Forums :netliconfetti: Thanks for your patience here-- it looks like this thread has been quiet for the past week.

Have you seen this part of our Docs that cover Swift? This would be a good place to start. Additionally, I recommend searching for older posts related to Swift as well. I have filtered for some here for you. :slight_smile:

Well, I have fix it. The reason is Publish is using SwiftUI to construct element in latest version. And it seems your site doesn’t support it(that SwiftUI file compiled failed). When I change that file to old Swift syntax, the issue is gone.

Our build environment will do whatever you or your dependencies tell it to do – it seems like there’s a dependency which isn’t quite as up-to-date, to support the latest SwiftUI features. It may be worth asking the Publish team for more info!

1 Like

Maybe, though the project compile ok in my local machine.