Skip to content

Netlify NextJS builds are broken in 3.7.0 when using multiple npm commands #528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
andismith opened this issue Jul 14, 2021 · 8 comments · Fixed by #529
Closed

Netlify NextJS builds are broken in 3.7.0 when using multiple npm commands #528

andismith opened this issue Jul 14, 2021 · 8 comments · Fixed by #529
Labels
priority: high type: bug code to address defects in shipped code

Comments

@andismith
Copy link

andismith commented Jul 14, 2021

Describe the bug
A bug has been introduced with version 3.7.0 where if the netlify.toml configuration file contains multiple npm commands such as npm run build && npm run export, the plugin fails with an internal error.

image

image

To Reproduce
Steps to reproduce the behavior:

  1. Fork https://github.com/andismith/nextjs-test-blog (this is a copy of the Netlify NextJS starter blog, with an adjusted netlify.toml file).
  2. Build it on Netlify
  3. See error
  4. Run npm install @netlify/[email protected] --save-dev
  5. See it now passes

Example at: https://app.netlify.com/sites/elated-mcclintock-cdc73c/deploys

Expected behavior
The build should still work in v3.7.0

Versions

  • Next.js: 11
  • @netlify/plugin-nextjs: 3.7.0

If you're using file-based installation

  • netlify.toml:
[build]
  publish = "dist"
  command = "npm run build && npm run export"

(this also occurs for multiple yarn commands too)

@andismith
Copy link
Author

I think it may be a result of b1fd513

@baeteja
Copy link

baeteja commented Jul 14, 2021

3.7.0 causes issues for me as well when I use multiple npm scripts.
A temporary workaround can be to create a separate npm script where you use the other scripts.
For example: "deploy": "next build && next export"

@lindsaylevine lindsaylevine added priority: high type: bug code to address defects in shipped code labels Jul 15, 2021
@ascorbic
Copy link
Contributor

Hi both! Thanks for the report. I've isolated the issue and opened a PR with a fix and should have that released later today.

@ascorbic
Copy link
Contributor

This is now published in 3.7.1. Can you check that this fixes it for you? I've added your specific command as a test case too.

@andismith
Copy link
Author

Thanks for attending to this so quick.

For some reason when building it in Netlify it's still picking up 3.7.0 at the latest version. I guess it takes a little while to propagate the new version. Will let you know once I can test this properly.

@ascorbic
Copy link
Contributor

ascorbic commented Jul 16, 2021

Yeah, we don't immediately update the auto-installed version, in case issues come up. It'll be auto-installed later today, but you can try it now by installing @netlify/plugin-nextjs@latest from npm.

@ascorbic
Copy link
Contributor

If you do a build now it should use the new version of the plugin.

@andismith
Copy link
Author

That's now working fine, thank you!

serhalp pushed a commit that referenced this issue Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants