SyntaxError: Unexpected token ')' does not match the underlying file that is linked to the deploy

site name:

Crux of issue –
3:34:39 PM: 2. Build command from Netlify app
3:34:39 PM: ────────────────────────────────────────────────────────────────
3:34:39 PM: ​
3:34:39 PM: $ gatsby build
3:34:41 PM: error We encountered an error while trying to load your site’s gatsby-config. Please fix the error and try again.
3:34:41 PM:
3:34:41 PM: Error: /opt/build/repo/gatsby-config.js:152
3:34:41 PM: });
3:34:41 PM: ^
3:34:41 PM: SyntaxError: Unexpected token ‘)’

when I look at the file, this end parenthesis is not present and line 152 does not even exist, as the file is 150 lines long. Line 150 ends with a curly brace: ‘}’

Are you able to share the repository you are deploying from, or the contents of the gatsby-config.js file?

Using VS Code, I see the gatsby-config.js file is indeed not valid. There is a } missing from the end.

I fixed this and got a new error:

5:02:47 PM: error (node:3341) [DEP0148] DeprecationWarning: Use of deprecated folder mapping “./” in the “exports” field module resolution of the package at /opt/build/repo/node_modules/postcss/package.json.
5:02:47 PM: Update this package.json to use a subpath pattern like “./*”.
5:02:47 PM: (Use node --trace-deprecation ... to show where the warning was created)
5:02:47 PM: error There was an error in your GraphQL query:
5:02:47 PM: Unknown type “ImageSharpFluid”.
5:02:47 PM: GraphQL request:2:37
5:02:47 PM: 1 |
5:02:47 PM: 2 | fragment GatsbyImageSharpFluid on ImageSharpFluid {
5:02:47 PM: | ^
5:02:47 PM: 3 | base64
5:02:47 PM: error There was an error in your GraphQL query:
5:02:47 PM: Cannot query field “childImageSharp” on type “File”.
5:02:47 PM: If you don’t expect “childImageSharp” to exist on the type “File” it is most likely a typo.
However, if you expect “childImageSharp” to exist there are a couple of solutions to common problems:
5:02:47 PM: - If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
5:02:47 PM: - The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
5:02:47 PM: - You want to optionally use your field “childImageSharp” and right now it is not used anywhere. Therefore Gatsby can’t infer the type and add it to the GraphQL schema. A quick fix is to add at least one entry with that field (“dummy content”)

Have you tried building locally? Does the same error occur?

With little experience using Gatsby, my best solution is to work through the error message and consult the Gatsby documentation

Hi @bill have you tired debugging your code first? Here is some documentation: [Support Guide] Debugging Netlify site builds