vercel / next.js

The React Framework
https://nextjs.org
MIT License
125.66k stars 26.83k forks source link

Problems debugging errors during build #9707

Closed kmcaloon closed 4 years ago

kmcaloon commented 4 years ago

So I am having a couple bugs/issues.

For this, all pages when running in dev are compiling ok. I am getting build errors telling me that a variable is not defined but doesn't specify where exactly.

Here is the error I am getting running next build with target: severless:

> Build error occurred
ReferenceError: propTypes is not defined
    at Object.e0hG (/Applications/MAMP/htdocs/dartdrones.com-next/.next/serverless/pages/[slug].js:7740:11)
    at __webpack_require__ (/Applications/MAMP/htdocs/dartdrones.com-next/.next/serverless/pages/[slug].js:23:31)
    at Object.E6Fb (/Applications/MAMP/htdocs/dartdrones.com-next/.next/serverless/pages/[slug].js:2821:70)
    at __webpack_require__ (/Applications/MAMP/htdocs/dartdrones.com-next/.next/serverless/pages/[slug].js:23:31)
    at Object.1TCz (/Applications/MAMP/htdocs/dartdrones.com-next/.next/serverless/pages/[slug].js:859:68)
    at __webpack_require__ (/Applications/MAMP/htdocs/dartdrones.com-next/.next/serverless/pages/[slug].js:23:31)
    at Module.K32+ (/Applications/MAMP/htdocs/dartdrones.com-next/.next/serverless/pages/[slug].js:3733:12)
    at __webpack_require__ (/Applications/MAMP/htdocs/dartdrones.com-next/.next/serverless/pages/[slug].js:23:31)
    at /Applications/MAMP/htdocs/dartdrones.com-next/.next/serverless/pages/[slug].js:91:18
    at Object.<anonymous> (/Applications/MAMP/htdocs/dartdrones.com-next/.next/serverless/pages/[slug].js:94:10)
error Command failed with exit code 1.

The thing is, it doesn't really specify where exactly the undefined variable is in my actual code.

For what it's worth, here is my actual [slug].js code:

import React from 'react';

const Demo = () => (

  <div>
    <h1>Slug</h1>
  </div>

);

export default Demo

Here is the error I am getting running next build without the serverless option:

> Build error occurred
ReferenceError: propTypes is not defined
    at Object.e0hG (/Applications/MAMP/htdocs/dartdrones.com-next/.next/server/static/gRaqPAu885ELZa4NiYNxG/pages/_app.js:599:11)
    at __webpack_require__ (/Applications/MAMP/htdocs/dartdrones.com-next/.next/server/static/gRaqPAu885ELZa4NiYNxG/pages/_app.js:23:31)
    at Object.E6Fb (/Applications/MAMP/htdocs/dartdrones.com-next/.next/server/static/gRaqPAu885ELZa4NiYNxG/pages/_app.js:207:70)
    at __webpack_require__ (/Applications/MAMP/htdocs/dartdrones.com-next/.next/server/static/gRaqPAu885ELZa4NiYNxG/pages/_app.js:23:31)
    at Module.1TCz (/Applications/MAMP/htdocs/dartdrones.com-next/.next/server/static/gRaqPAu885ELZa4NiYNxG/pages/_app.js:113:68)
    at __webpack_require__ (/Applications/MAMP/htdocs/dartdrones.com-next/.next/server/static/gRaqPAu885ELZa4NiYNxG/pages/_app.js:23:31)
    at Object.1 (/Applications/MAMP/htdocs/dartdrones.com-next/.next/server/static/gRaqPAu885ELZa4NiYNxG/pages/_app.js:99:18)
    at __webpack_require__ (/Applications/MAMP/htdocs/dartdrones.com-next/.next/server/static/gRaqPAu885ELZa4NiYNxG/pages/_app.js:23:31)
    at /Applications/MAMP/htdocs/dartdrones.com-next/.next/server/static/gRaqPAu885ELZa4NiYNxG/pages/_app.js:91:18
    at Object.<anonymous> (/Applications/MAMP/htdocs/dartdrones.com-next/.next/server/static/gRaqPAu885ELZa4NiYNxG/pages/_app.js:94:10)
error Command failed with exit code 1.

Is there any way I can improve these messages for better debugging?

timneutkens commented 4 years ago

Please follow the issue template.

https://github.com/zeit/next.js/issues/new/choose

https://github.com/zeit/next.js/issues/new?template=8.Question_about_next.md

# Question about Next.js

GitHub Issues are reserved for Bug reports and Feature requests. The best place to get your question answered is to post it on https://spectrum.chat/next-js.
balazsorban44 commented 2 years ago

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.