vercel / analytics

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

Module not found: Can't resolve 'react' #12

Closed sorokinvj closed 2 years ago

sorokinvj commented 2 years ago

Hello,

I did the example from the docs: yarn add @vercel/analytics During install get warning " > @vercel/analytics@0.1.3" has unmet peer dependency "react@^16.8||^17||^18". And after installing and putting in _app.tsx:

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

I got error:

Screenshot 2022-10-29 at 20 40 43

Here is my package.json:

{
  "private": true,
  "scripts": {
    "dev": "next",
    "build": "next build",
    "start": "next start",
    "typecheck": "tsc",
    "prepare": "husky install"
  },
  "dependencies": {
    "@microflash/remark-figure-caption": "^1.0.0",
    "@wooorm/starry-night": "^1.1.0",
    "classnames": "2.3.1",
    "date-fns": "2.21.3",
    "gray-matter": "4.0.3",
    "hast-util-to-string": "^2.0.0",
    "next": "^12.1.6",
    "prettier": "^2.5.1",
    "react": "^18.1.0",
    "react-dom": "^18.1.0",
    "rehype-document": "^6.0.1",
    "rehype-format": "^4.0.1",
    "rehype-highlight": "^5.0.2",
    "rehype-stringify": "^9.0.3",
    "remark": "14.0.2",
    "remark-rehype": "^10.1.0",
    "typescript": "^4.2.4"
  },
  "devDependencies": {
    "@types/jest": "^26.0.23",
    "@types/node": "^15.6.0",
    "@types/react": "^18.0.12",
    "@types/react-dom": "^18.0.5",
    "autoprefixer": "10.4.0",
    "eslint": "8.17.0",
    "eslint-config-next": "12.1.6",
    "eslint-config-prettier": "^8.5.0",
    "husky": "^8.0.0",
    "lint-staged": "^13.0.1",
    "postcss": "8.4.5",
    "tailwindcss": "3.0.5"
  }
}
sorokinvj commented 2 years ago

sorry, package just did not get into package.json somehow, re-installed and everything is fine now