question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[ error ] ./node_modules/@sentry/node/esm/integrations/console.js Module not found: Can't resolve 'console' in - Sentry in Nextjs

See original GitHub issue

Package + Version

  • @sentry/browser ^5.11.0
  • @sentry/node^5.11.0
  • nodev12.7.0

Description

I have a nextjs application and I followed this tutorial provided by nextjs community. The problem is after building and running my app it gives this error:

[ error ] ./node_modules/@sentry/node/esm/integrations/console.js
Module not found: Can't resolve 'console' in '/.../node_modules/@sentry/node/esm/integrations'

I rebuild my app and removed my yarn lock and build folder but nothing happened! Although I have the directory in my node_modules!

The error is when I’m trying to import Sentry like this :

import * as Sentry from '@sentry/node';

Screenshot from 2020-01-11 12-56-20

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:18
  • Comments:24 (1 by maintainers)

github_iconTop GitHub Comments

17reactions
bscasparcommented, May 7, 2021

For anyone using the latest update with @sentry/nextjs after running the new setup (which simplified things quite a bit), change all of your imports from import * as Sentry from '@sentry/node'; to import * as Sentry from '@sentry/nextjs';.

15reactions
danielhusarcommented, Mar 20, 2020

Add:

if (!options.isServer) {
  config.resolve.alias['@sentry/node'] = '@sentry/browser'
}

to the next.config.js

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module not found: Can't resolve 'console' #24966 - GitHub
When resolving a nextjs page the error is thrown in the server side console. error - ./node_modules/@sentry/node/esm/integrations/console.js:19:0 Module not ...
Read more >
integrating Sentry in Next.js project - Stack Overflow
js with AMP. That means my code runs only on the server. no client code. I'm trying to integrate @sentry/node However, while ...
Read more >
Hardhat Can't resolve 'console' on react project
This is error message when the project is compiling ./node_modules/@sentry/node/esm/integrations/console.js Module not found: Can't resolve ...
Read more >
NodeJS: Missing dependencies - SDKs - #sentry
Hi everyone, I'm trying to connect Sentry to NextJS/React app. So far I've successfully connected from client (React) via @sentry/browser, ...
Read more >
@sentry/nextjs - npm
This package is a wrapper around @sentry/node for the server and @sentry/react for the client, with added functionality related to Next.js.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found