Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Problems deploying Next.js Landing page sample site on Netlify, seeking help from Slack community

19 replies
Last updated: Feb 4, 2022
Hi! I'm trying Sanity for the first time but the Next.js Landing page sample site had problems deploying on netlify and I really need some help.
Feb 1, 2022, 10:50 AM
The prompt said to contact the slack community so I came here straight.
Feb 1, 2022, 10:52 AM
Is there any errors outputted into the deploy log from Netlify?
Feb 1, 2022, 12:19 PM
Can I paste the logs here?
Feb 1, 2022, 12:44 PM
there's a bunch of errors
Feb 1, 2022, 12:46 PM
Yeah, should be fine to paste here, you may want to go through it before though incase there is anything private that you don’t want to show etc
Feb 1, 2022, 1:23 PM
11:37:13 AM: ────────────────────────────────────────────────────────────────11
:37:13 AM: 1. Build command from Netlify app 11
:37:13 AM: ────────────────────────────────────────────────────────────────
11:37:13 AM:
11:37:13 AM: $ npm run build-web
11:37:14 AM: > sanity-nextjs-landing-pages@1.0.12 build-web
11:37:14 AM: > lerna bootstrap && (cd web && npm run build)
11:37:14 AM: lerna notice cli v4.0.0
11:37:14 AM: lerna info ci enabled
11:37:15 AM: lerna info Bootstrapping 2 packages
11:37:15 AM: lerna info Symlinking packages and binaries
11:37:15 AM: lerna success Bootstrapped 2 packages
11:37:15 AM: > sanity-nextjs-landing-pages-web@1.0.12 build
11:37:15 AM: > next build && next export && node exportSitemap.js
11:37:16 AM: warn  - No build cache found. Please configure build caching for faster rebuilds. Read more: <https://nextjs.org/docs/messages/no-cache>
11:37:16 AM: info  - Checking validity of types...
11:37:17 AM: warn  - The Next.js plugin was not detected in your ESLint configuration. See <https://nextjs.org/docs/basic-features/eslint#migrating-existing-config>
11:37:18 AM:
11:37:18 AM: Failed to compile.
11:37:18 AM: ./pages/CustomPage.js
11:37:18 AM: Error: Parsing error: require() of ES Module /opt/build/repo/web/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js not supported.
11:37:18 AM: Instead change the require of definition.js in /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js to a dynamic import() which is available in all CommonJS modules.
11:37:18 AM: ./pages/LandingPage.js
11:37:18 AM: Error: Parsing error: require() of ES Module /opt/build/repo/web/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js not supported.
11:37:18 AM: Instead change the require of definition.js in /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js to a dynamic import() which is available in all CommonJS modules.
11:37:18 AM: ./pages/_app.js
11:37:18 AM: Error: Parsing error: require() of ES Module /opt/build/repo/web/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js not supported.
11:37:18 AM: Instead change the require of definition.js in /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js to a dynamic import() which is available in all CommonJS modules.
11:37:18 AM: ./pages/_document.js
11:37:18 AM: Error: Parsing error: require() of ES Module /opt/build/repo/web/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js not supported.
11:37:18 AM: Instead change the require of definition.js in /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js to a dynamic import() which is available in all CommonJS modules.
11:37:18 AM: ./pages/index.js
11:37:18 AM: Error: Parsing error: require() of ES Module /opt/build/repo/web/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js not supported.
11:37:18 AM: Instead change the require of definition.js in /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js to a dynamic import() which is available in all CommonJS modules.
11:37:18 AM: ./components/Cta.js
11:37:18 AM: Error: Parsing error: require() of ES Module /opt/build/repo/web/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js not supported.
11:37:18 AM: Instead change the require of definition.js in /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js to a dynamic import() which is available in all CommonJS modules.
11:37:18 AM: ./components/EmbedHTML.js
11:37:18 AM: Error: Parsing error: require() of ES Module /opt/build/repo/web/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js not supported.
11:37:18 AM: Instead change the require of definition.js in /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js to a dynamic import() which is available in all CommonJS modules.
11:37:18 AM: ./components/Figure.js
11:37:18 AM: Error: Parsing error: require() of ES Module /opt/build/repo/web/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js not supported.
11:37:18 AM: Instead change the require of definition.js in /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js to a dynamic import() which is available in all CommonJS modules.
11:37:18 AM: ./components/Footer.js
11:37:18 AM: Error: Parsing error: require() of ES Module /opt/build/repo/web/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js not supported.
11:37:18 AM: Instead change the require of definition.js in /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js to a dynamic import() which is available in all CommonJS modules.
11:37:18 AM: ./components/Header.js
11:37:18 AM: Error: Parsing error: require() of ES Module /opt/build/repo/web/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js not supported.
11:37:18 AM: Instead change the require of definition.js in /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js to a dynamic import() which is available in all CommonJS modules.
11:37:18 AM: ./components/Layout.js
11:37:18 AM: Error: Parsing error: require() of ES Module /opt/build/repo/web/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js not supported.
11:37:18 AM: Instead change the require of definition.js in /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js to a dynamic import() which is available in all CommonJS modules.
11:37:18 AM: ./components/RenderSections.js
11:37:18 AM: Error: Parsing error: require() of ES Module /opt/build/repo/web/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js not supported.
11:37:18 AM: Instead change the require of definition.js in /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js to a dynamic import() which is available in all CommonJS modules.
11:37:18 AM: ./components/SimpleBlockContent.js
11:37:18 AM: Error: Parsing error: require() of ES Module /opt/build/repo/web/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js not supported.
11:37:18 AM: Instead change the require of definition.js in /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js to a dynamic import() which is available in all CommonJS modules.
11:37:18 AM: ./components/icons/Hamburger.js
11:37:18 AM: Error: Parsing error: require() of ES Module /opt/build/repo/web/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js not supported.
11:37:18 AM: Instead change the require of definition.js in /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js to a dynamic import() which is available in all CommonJS modules.
11:37:18 AM: ./components/sections/Hero.js
11:37:18 AM: Error: Parsing error: require() of ES Module /opt/build/repo/web/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js not supported.
11:37:18 AM: Instead change the require of definition.js in /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js to a dynamic import() which is available in all CommonJS modules.
11:37:18 AM: ./components/sections/ImageSection.js
11:37:18 AM: Error: Parsing error: require() of ES Module /opt/build/repo/web/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js not supported.
11:37:18 AM: Instead change the require of definition.js in /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js to a dynamic import() which is available in all CommonJS modules.
11:37:18 AM: ./components/sections/Mailchimp.js
11:37:18 AM: Error: Parsing error: require() of ES Module /opt/build/repo/web/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js not supported.
11:37:18 AM: Instead change the require of definition.js in /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js to a dynamic import() which is available in all CommonJS modules.
11:37:18 AM: ./components/sections/TextSection.js
11:37:18 AM: Error: Parsing error: require() of ES Module /opt/build/repo/web/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js not supported.
11:37:18 AM: Instead change the require of definition.js in /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js to a dynamic import() which is available in all CommonJS modules.
11:37:18 AM: ./components/sections/index.js
11:37:18 AM: Error: Parsing error: require() of ES Module /opt/build/repo/web/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js not supported.
11:37:18 AM: Instead change the require of definition.js in /opt/build/repo/web/node_modules/babel-eslint/lib/require-from-eslint.js to a dynamic import() which is available in all CommonJS modules.
11:37:18 AM: info  - Need to disable some ESLint rules? Learn more here: <https://nextjs.org/docs/basic-features/eslint#disabling-rules>
11:37:18 AM:

1118 AM: ────────────────────────────────────────────────────────────────
1118 AM: "build.command" failed
1118 AM: ────────────────────────────────────────────────────────────────
1118 AM:
1118 AM: Error message
1118 AM: Command failed with exit code 1: npm run build-web
1118 AM:
1118 AM: Error location
1118 AM: In Build command from Netlify app:
1118 AM: npm run build-web
1118 AM:
1118 AM: Resolved config
1118 AM: build:
1118 AM: base: /opt/build/repo
1118 AM: command: npm run build-web
1118 AM: commandOrigin: ui
1118 AM: environment:
1118 AM: - SANITY_DEPLOY_STUDIO_TOKEN
1118 AM: publish: /opt/build/repo/web/out
1118 AM: publishOrigin: ui
Feb 1, 2022, 1:27 PM
Hmm, could you show some examples of how you are importing your components in the relevant templates please?
Feb 1, 2022, 1:37 PM
Also, have you tested this locally?
Feb 1, 2022, 1:38 PM
I haven' tested it locally. I used the template thingy on the site and when it returned the errors i went to check the netlify logs
Feb 1, 2022, 1:40 PM
Hmm, in that case I wonder if there are some problems with this particular starter that need to be resolved, might be an idea to report an issue here: https://github.com/sanity-io/sanity-template-nextjs-landing-pages/issues
Feb 1, 2022, 2:39 PM
Hi User! I just got the same failure while trying to build one from scratch myself. I’m going to dig into this some and get back with you. This looks like a problem in the frontend configuration. In the meantime, if you just want to get some quick hands on, the nextjs blog with comments starter is working well for me.

https://www.sanity.io/create?template=sanity-io%2Fsanity-template-nextjs-blog-comments
Feb 2, 2022, 5:22 PM
so netlify (or perhaps cors) isn’t happy about something. I was able to get mine to run locally.
npm run dev

> sanity-nextjs-landing-pages@1.0.12 dev
> lerna run dev --parallel

lerna notice cli v4.0.0
lerna info Executing command in 2 packages: "npm run dev"
sanity-nextjs-landing-pages-studio: > sanity-nextjs-landing-pages-studio@1.0.11 dev
sanity-nextjs-landing-pages-studio: > sanity start
sanity-nextjs-landing-pages-web: > sanity-nextjs-landing-pages-web@1.0.12 dev
sanity-nextjs-landing-pages-web: > next
sanity-nextjs-landing-pages-web: ready - started server on 0.0.0.0:3000, url: <http://localhost:3000>
sanity-nextjs-landing-pages-web: Defining routes from exportPathMap
sanity-nextjs-landing-pages-studio: ✔ Checking configuration files...
sanity-nextjs-landing-pages-studio: - Compiling...
sanity-nextjs-landing-pages-web: Browserslist: caniuse-lite is outdated. Please run next command `npm update`
sanity-nextjs-landing-pages-web: event - compiled client and server successfully in 1507 ms (222 modules)
sanity-nextjs-landing-pages-studio: webpack built dad45f21359b4c8ec361 in 6555ms
sanity-nextjs-landing-pages-studio: ✔ Compiling...
sanity-nextjs-landing-pages-studio: Content Studio successfully compiled! Go to <http://localhost:3333>
sanity-nextjs-landing-pages-web: wait  - compiling /LandingPage (client and server)...
sanity-nextjs-landing-pages-web: event - compiled client and server successfully in 675 ms (336 modules)
sanity-nextjs-landing-pages-web: Next.js auto-prefetches automatically based on viewport. The prefetch attribute is no longer needed. More: <https://nextjs.org/docs/messages/prefetch-true-deprecated>
sanity-nextjs-landing-pages-web: Next.js auto-prefetches automatically based on viewport. The prefetch attribute is no longer needed. More: <https://nextjs.org/docs/messages/prefetch-true-deprecated>
sanity-nextjs-landing-pages-web: Next.js auto-prefetches automatically based on viewport. The prefetch attribute is no longer needed. More: <https://nextjs.org/docs/messages/prefetch-true-deprecated>
sanity-nextjs-landing-pages-web: Next.js auto-prefetches automatically based on viewport. The prefetch attribute is no longer needed. More: <https://nextjs.org/docs/messages/prefetch-true-deprecated>
sanity-nextjs-landing-pages-web: Next.js auto-prefetches automatically based on viewport. The prefetch attribute is no longer needed. More: <https://nextjs.org/docs/messages/prefetch-true-deprecated>
sanity-nextjs-landing-pages-web: wait  - compiling /_error (client and server)...
Feb 2, 2022, 5:31 PM
so netlify (or perhaps cors) isn’t happy about something. I was able to get mine to run locally.```
Feb 2, 2022, 5:31 PM
oh I found A problem for sure - nexjs eslint rules perhaps not defined correctly in the web: https://nextjs.org/docs/basic-features/eslint
Feb 2, 2022, 5:34 PM
this would only affect the build environment, I’m going to try to patch it in my local build now
Feb 2, 2022, 5:34 PM
okay it isn’t as simple as a linting issue - some next get*props methods need tlc in this example perhaps. I will forward this to the team. Still in the meantime, if you just want to test things - the studio in this example build appears to work well, and the next blog with comments along with other starters also work well. Here is the get serverside error I am getting at present. There may be a simple way to resolve this that I don’t know yet. https://nextjs.org/docs/messages/gssp-export
Feb 2, 2022, 6:03 PM
okay it isn’t as simple as a linting issue - some next get*props methods need tlc in this example perhaps. I will forward this to the team. Still in the meantime, if you just want to test things - the studio in this example build appears to work well, and the next blog with comments along with other starters also work well. Here is the get serverside error I am getting at present. There may be a simple way to resolve this that I don’t know yet. https://nextjs.org/docs/messages/gssp-export
Feb 2, 2022, 6:03 PM
Hi User - Circling back on this. The lovely and talented User was able to make a pass on this and get everything working again. I just deployed it myself to test and the install was very smooth. You are welcome to deploy again from scratch or if you have entered data into your previous build, you can redeploy and swap projectIds and settings to the new fixed deployment. Here is my successful starter: https://example-nextjslandingpage-netlify-fixed.netlify.app/
Feb 4, 2022, 5:46 PM
Thank you so much for the help with this I'll try it out again.
Feb 4, 2022, 6:07 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?