We just released a new version of next-multilingual where one of the core change was supporting localized APIs and now the Netlify build is failing (while it is working on Vercel and locally).
6:49:22 PM: ────────────────────────────────────────────────────────────────
6:49:22 PM: Dependencies installation error
6:49:22 PM: ────────────────────────────────────────────────────────────────
6:49:22 PM:
6:49:22 PM: Error message
6:49:22 PM: A Netlify Function failed to require one of its dependencies.
6:49:22 PM: Please make sure it is present in the site's top-level "package.json".
6:49:22 PM: In file "/opt/build/repo/.netlify/functions-internal/next_index/next_index.js"
6:49:22 PM: Cannot find module '../webpack-runtime.js' from '/opt/build/repo/.netlify/functions-internal/next_index/nextPage/pages'
7:53:37 PM: Error message
7:53:37 PM: A Netlify Function failed to require one of its dependencies.
7:53:37 PM: Please make sure it is present in the site's top-level "package.json".
7:53:37 PM: Build failed with 1 error:
7:53:37 PM: .netlify/functions-internal/next_index/nextPage/pages/index.js:560:34: error: Could not resolve "../webpack-runtime.js"
While I am not as proficient in Next.js as many others, I do wonder if using a canary build of Next.js is (in part) causing part of the issues (i.e. "next": "^11.1.3-canary.97", from the package.json.) Last I knew, Next.js 11.1.2 support was still beta/experimental in the netlify-plugin-nextjs.
I know I am pushing it a bit using bleeding-edge builds here, but it is working well on Vercel and locally so I thought I would still check if there was any change here since my latest build.
I also had issues the first time I deployed Next but we managed to fix it.
True. But unless people use the latest (I love testing beta/canary/pre-production of anything) it is hard to move things forward.
Working on Vercel is different to working on Netlify. They are different platforms, different methodologies, etc. Next.js is developed/maintained by Vercel, so they will always have the upperhand when it comes to supporting the latest builds/features. (This is purely my opinion. I neither speak for Netlify or Vercel.)
Seconding @coelmay here, have you checked that you’re using the latest plugin version? Additionally, I recommend bringing this conversation to the Beta V4 thread on our repo. This is a direct connection to the NextJS experts at Netlify!
Also did this npm install -D @netlify/plugin-nextjs-experimental
And I am getting the following error:
1:03:46 PM: ────────────────────────────────────────────────────────────────
1:03:46 PM: Dependencies installation error
1:03:46 PM: ────────────────────────────────────────────────────────────────
1:03:46 PM:
1:03:46 PM: Error message
1:03:46 PM: A Netlify Function failed to require one of its dependencies.
1:03:46 PM: Please make sure it is present in the site's top-level "package.json".
1:03:46 PM: In file "/opt/build/repo/.netlify/functions-internal/next_index/next_index.js"
1:03:46 PM: Cannot find module '../webpack-runtime.js' from '/opt/build/repo/.netlify/functions-internal/next_index/nextPage/pages'
Thanks for letting us know. I’m still not seeing that you used the most recent beta plugin in your above messages. Can you please upgrade to our newest plugin? In your post from 8 days ago it looks like you were still using the @netlify/plugin-nextjs-experimental.
Sorry for the late reply @hillary - I thought that I initially started without using the experimental plugin and then tried that one and the result was both the same - unless there is something else I need to do to try the most recent beta plugin?
Just to be sure I re-run a build, with both Next.js canary.67 and I am getting the same error.
Thanks @hillary I made some progress. Now there are no more deployment errors but the site returns a 500:
I noticed in the log there seem to be a lot of redirects? In my repo I add a lot of other redirects in the Nex.js config… not sure if it’s related to not.
Given we have been troubleshooting this for weeks, may I suggest that you fork my repo? I suspect you would probably be able to pinpoint the issue better than me
We discussed this with our devs one more time and we were told that the latest version of the plugin beta7 would log in the build log in case you have anything leftover from the previous version’s functions. This might be a good place to try.
Also, about the 500s, you should try checking the function logs as soon as you get the error to see what it says. Once we have the logs, we can debug it accordingly.
I know that the URL is the one we use for Vercel, but it should not have triggered this error. Are you integrated with the .env files that Next.js uses?