Error: error: Expected ';', got 'assert' when trying to deploy on Vercel
See original GitHub issueSummary
When trying to deploy on vercel a NextJs project with contentlayer
installed I get this error message on vercel build:
Click to expand
[21:20:00.600] Cloning github.com/zaniluca/zaniluca.com (Branch: blog-setup, Commit: fac6d7f)
[21:20:01.007] Cloning completed: 406.525ms
[21:20:01.837] Looking up build cache...
[21:20:02.294] Build Cache not found
[21:20:02.518] Running "vercel build"
[21:20:02.993] Vercel CLI 25.2.0 build (beta) — https://vercel.com/feedback
[21:20:03.270] Installing dependencies...
[21:20:03.610] yarn install v1.22.17
[21:20:03.682] [1/4] Resolving packages...
[21:20:03.882] [2/4] Fetching packages...
[21:20:19.529] [3/4] Linking dependencies...
[21:20:19.530] warning "contentlayer > @contentlayer/source-files > date-fns-tz@1.3.5" has unmet peer dependency "date-fns@>=2.0.0".
[21:20:19.532] warning "contentlayer > @contentlayer/utils > @opentelemetry/exporter-trace-otlp-grpc > @opentelemetry/core@1.0.1" has incorrect peer dependency "@opentelemetry/api@>=1.0.0 <1.1.0".
[21:20:19.532] warning "contentlayer > @contentlayer/utils > @opentelemetry/exporter-trace-otlp-grpc > @opentelemetry/resources@1.0.1" has incorrect peer dependency "@opentelemetry/api@>=1.0.0 <1.1.0".
[21:20:19.534] warning "contentlayer > @contentlayer/utils > @opentelemetry/exporter-trace-otlp-grpc > @opentelemetry/sdk-trace-base@1.0.1" has incorrect peer dependency "@opentelemetry/api@>=1.0.0 <1.1.0".
[21:20:19.551] warning Workspaces can only be enabled in private projects.
[21:20:19.552] warning Workspaces can only be enabled in private projects.
[21:20:19.555] warning Workspaces can only be enabled in private projects.
[21:20:33.527] [4/4] Building fresh packages...
[21:20:36.513] Done in 32.91s.
[21:20:36.542] Detected Next.js version: 12.1.0
[21:20:36.544] Running "yarn run build"
[21:20:36.817] yarn run v1.22.17
[21:20:36.848] $ next build
[21:20:39.931] Generated 1 documents in .contentlayer
[21:20:39.967] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[21:20:39.967] This information is used to shape Next.js' roadmap and prioritize features.
[21:20:39.967] You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
[21:20:39.967] https://nextjs.org/telemetry
[21:20:39.967]
[21:20:40.021] info - Checking validity of types...
[21:20:46.627] warn - No ESLint configuration detected. Run next lint to begin setup
[21:20:46.630] info - Creating an optimized production build...
[21:20:57.127] Failed to compile.
[21:20:57.127]
[21:20:57.128] ./.contentlayer/generated/index.mjs
[21:20:57.128] Error: error: Expected ';', got 'assert'
[21:20:57.128]
[21:20:57.128] |
[21:20:57.128] 7 | import allBlogPosts from './BlogPost/_index.json' assert { type: 'json' }
[21:20:57.129] | ^^^^^^
[21:20:57.129]
[21:20:57.129] Caused by:
[21:20:57.129] 0: failed to process js file
[21:20:57.129] 1: Syntax Error
[21:20:57.129]
[21:20:57.129] Import trace for requested module:
[21:20:57.129] ./pages/blog/[slug].tsx
[21:20:57.129]
[21:20:57.129]
[21:20:57.129] > Build failed because of webpack errors
[21:20:57.196] error Command failed with exit code 1.
[21:20:57.197] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[21:20:57.223] Error! Command "yarn run build" exited with 1
[21:20:57.322] Error: Command "vercel build" exited with 1
When trying to run build
locally it works fine.
I’m using:
- “next”: “12.1.0”
- “next-contentlayer”: “^0.2.5”
- “contentlayer”: “^0.2.5”
Issue Analytics
- State:
- Created a year ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Errors – Vercel Docs
A list of errors provided by Vercel CLI or the REST API, with details on how they occur and how to resolve them....
Read more >node-canvas runtime error · Issue #3460 · vercel ... - GitHub
Hi , I'm having a runtime error with my app that uses node-canvas@2.6.0. It doesn't uses it directly, but through the package ...
Read more >getServerSideProps causes 500 error when deployed on vercel
When I'm running my code in localhost everything works how I want it, but when I run it on vercel it sends a...
Read more >How to Build a Full Stack NFT Marketplace - V2 (2022)
Has anyone received the following error? ... You must provide RPC url of the testnet where you want to deploy NFT ... Expected...
Read more >Vercel - Checkly
Installation To install Checkly's native Vercel integration, navigate to ... syntax errors in the script, or assertions using the expect or assert libraries ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@schickling yep, it worked! thank you again!
Thanks a lot @zaniluca. This seems a bit odd. I was just able to reproduce the problem you described locally when running
yarn build
.However, the problem disappeared after upgrading to Next.js 12.2. So I assume it was a bug in Next.js that was fixed.
Please let me know if you need further help!