vercel / analytics

Privacy-friendly, real-time traffic insights
https://vercel.com/analytics
Mozilla Public License 2.0
422 stars 26 forks source link

NextJS App won't build with `pnpm` #69

Closed StevenLangbroek closed 1 year ago

StevenLangbroek commented 1 year ago

Hey folks! I've followed the quickstart instructions, but am presented with this error when building our app with pnpm on Github Actions:

image

What info can I provide to help reproduce this issue?

tobiaslins commented 1 year ago

Hey @StevenLangbroek ! Which version of @vercel/analytics do you have in your package.json?

Thanks :)

StevenLangbroek commented 1 year ago

@tobiaslins it's ^1.0.0, which has resolved to drumroll 1.0.0 :D

tobiaslins commented 1 year ago

I see you're using next@13.1.6 and I think at that version there was no support for "use client" that was shipped in packages. Can you try to either upgrade to latest Next.js or try wrapping our analytics component before like following:

'use client';

import { Analytics } from '@vercel/analytics/react';

export function VercelWebAnalytics(): JSX.Element {
  return (
    <Analytics />
  );
}

and in layout.tsx use <VercelWebAnalytics />

Let me know if that resolves your issue!

StevenLangbroek commented 1 year ago

Ahhh that's right yeah, we're a little behind and the migration is a bit painful. Will try the workaround for now, let you know how it goes. Thanks!

tobiaslins commented 1 year ago

Hey @StevenLangbroek , is it working now? Thanks!

StevenLangbroek commented 1 year ago

@tobiaslins whoops yes it is! Thanks for the assistance