1
votes

I'm using Next.js with styledcomponent, It gets no error in Dev mode. but while running in Build production mode. I get an error. without line number or file name.

I have also opened an issue Github https://github.com/zeit/next.js/issues/5932

ERROR

NODE_ENV=production node server.js

Ready on http://localhost:3000 Error: An error occurred. See https://github.com/styled-components/styled-components/blob/master/src/utils/errors.md#1 for more information. Additional arguments: undefined at new StyledComponentsError (/Users/rahulkishan/Documents/React_Mobile_and_web/ReactWebV1/purchaseweb/node_modules/styled-components/dist/styled-components.cjs.js:161:58) at constructWithOptions (/Users/rahulkishan/Documents/React_Mobile_and_web/ReactWebV1/purchaseweb/node_modules/styled-components/dist/styled-components.cjs.js:2182:13) at styled (/Users/rahulkishan/Documents/React_Mobile_and_web/ReactWebV1/purchaseweb/node_modules/styled-components/dist/styled-components.cjs.js:2126:12) at Object. (/Users/rahulkishan/Documents/React_Mobile_and_web/ReactWebV1/purchaseweb/.next/server/static/i2aIDkRZkhvVhtPxvk4BE/pages/index.js:4504:77)

Why it shows this error in Build mode only. Not in dev mode. We have built a large app. It is really difficult to find the problem.

1

1 Answers

-1
votes

Error has its path

static/../pages/index.js

And line number as well

After giving npm run build

Nexts js creates a build folder as

/.next/server/static

Inside that folder you will be able to see the complete production code.