Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't install @sentry/nextjs in next 11 project #3700

Closed
4 of 8 tasks
pyprism opened this issue Jun 17, 2021 · 3 comments
Closed
4 of 8 tasks

Can't install @sentry/nextjs in next 11 project #3700

pyprism opened this issue Jun 17, 2021 · 3 comments
Assignees
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK Type: Bug

Comments

@pyprism
Copy link

pyprism commented Jun 17, 2021

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other:

Version:

@sentry/nextjs

Description

When I tried to install latest @sentry/nextjs package I got this error:

npm install --save @sentry/nextjs
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: ***@0.1.0
npm ERR! Found: [email protected]
npm ERR! node_modules/next
npm ERR!   next@"11.0.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer next@"^10.0.8" from @sentry/[email protected]
npm ERR! node_modules/@sentry/nextjs
npm ERR!   @sentry/nextjs@"*" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /home/prism/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/prism/.npm/_logs/2021-06-17T17_56_44_854Z-debug.log

here is my project package.json

{
  "name": "***",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "size": "ANALYZE=true next build",
    "start": "next start -p 4321"
  },
  "dependencies": {
    "@next/bundle-analyzer": "^11.0.0",
    "axios": "^0.21.1",
    "escape-string-regexp": "^5.0.0",
    "luxon": "^1.27.0",
    "next": "11.0.0",
    "next-pwa": "^5.2.21",
    "next-seo": "^4.25.1",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-responsive-carousel": "^3.2.18"
  },
  "devDependencies": {
    "@babel/core": "^7.14.6",
    "@babel/preset-env": "^7.14.5",
    "bulma": "^0.9.2",
    "sass": "^1.35.1",
    "webpack": "^5.39.0"
  }
}

and next.config.js content:

const withPWA = require('next-pwa');
const path = require('path');

const withBundleAnalyzer = require('@next/bundle-analyzer')({
    enabled: process.env.ANALYZE === 'true',
})

let domain = '***';


let nextConfig = {
    target: "serverless",
    sassOptions: {
        includePaths: [path.join(__dirname, 'styles')],
    },
    env: {
        domain: domain,
    },
    images: {
        domains: ['***'],
    },
    pwa: {
        dest: 'public',
    }
}


if(process.env.DEBUG) {
    domain = 'http://localhost:8000';
    module.exports = withBundleAnalyzer({
        env: {
            domain: domain,
        },
        images: {
            domains: ['**'],
        },

    })
}

module.exports = withPWA(nextConfig);
@AbhiPrasad AbhiPrasad self-assigned this Jun 17, 2021
@AbhiPrasad AbhiPrasad added Package: nextjs Issues related to the Sentry Nextjs SDK and removed Status: Needs Triage labels Jun 17, 2021
@mikestopcontinues
Copy link

I think there might be a limiting code issue. After npm install -f, I get the following error:

[Sentry] Could not initialize SDK. Received error:
Error: Cannot find module '/Users/Code/hub/.next/server/sentry/initServerSDK.js'
Require stack:
- /Users/Code/hub/node_modules/@sentry/nextjs/dist/utils/instrumentServer.js
- /Users/Code/hub/node_modules/@sentry/nextjs/dist/index.server.js
- /Users/Code/hub/next.config.js
- /Users/Code/hub/node_modules/next/dist/next-server/server/config.js
- /Users/Code/hub/node_modules/next/dist/server/next.js
- /Users/Code/hub/node_modules/next/dist/server/lib/start-server.js
- /Users/Code/hub/node_modules/next/dist/cli/next-dev.js
- /Users/Code/hub/node_modules/next/dist/bin/next

Just to clarify, this issue only started after updating to Next 11.

@maxbeatty
Copy link

#3711 fixed the peer dependency issue but it doesn't appear to be released yet

@HazAT
Copy link
Member

HazAT commented Jun 28, 2021

This should be fixed with 6.8.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK Type: Bug
Projects
None yet
Development

No branches or pull requests

6 participants