Skip to content
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

Having "next export" in npm script fails build, even if unused. #67

Closed
racedale opened this issue Dec 5, 2020 · 6 comments · Fixed by #72
Closed

Having "next export" in npm script fails build, even if unused. #67

racedale opened this issue Dec 5, 2020 · 6 comments · Fixed by #72

Comments

@racedale
Copy link

racedale commented Dec 5, 2020

Error message ** Static HTML export next.js projects do not require this plugin ** was caused by "export": "next export" existing in my package.json file. I removed "npm run export" from my netlify.toml file when converting my site from SSG to adding some SSR pages, but had left that command in package.json (not documented in any posts that I would need to make sure to remove it).

Was very very confusing to figure out. I think the easiest fix is updating the error message to be more specific to what is detected. But maybe there is another thing to detect off of? I'm new to Next so not sure.

File with detection logic

Also off topic, but for a new NextJS dev the docs around next-on-netlify vs this plugin were confusing. Is next-on-netlify legacy? Is this one the only way to also have custom functions?

@lindsaylevine
Copy link

hey @racedale thanks so much for bringing this up!!! really value your insight/feedback :).

  1. would love to hear what an ideal error message would've been for you to read/diagnose that build failure! if you don't have one, no worries! i can definitely make it more specific and point devs in the right direction.

  2. yes, we need to clarify that :( it's been tough because internally our mission is to make next.js "just work" on netlify. that means in the not so distant future, this plugin will be automatically installed on all new next.js sites, without needing to add it yourself. for that reason, we've been unfortunately ambiguous about NoN vs plugin. NoN will likely always exist as its own repo, but using it as a manual install will become "legacy"/deprecated/the uncommon path.

  3. yes this is the only way right now to use custom functions and publish dirs!

@chriscoyier
Copy link

Noting that this just super confused me. I removed the export from the .toml file, but just that existing at all in package.json triggered the failed, even totally unused.

@gianpaj
Copy link

gianpaj commented Dec 21, 2020

Hi,

At the bottom of the announcement blog post it says to deploy:
@cassidoo's https://github.com/cassidoo/next-netlify-starter

I get this error:

1:04:57 PM:   Plugin "@netlify/plugin-nextjs" failed                        
1:04:57 PM: ────────────────────────────────────────────────────────────────
1:04:57 PM: ​
1:04:57 PM:   Error message
1:04:57 PM:   Error: ** Static HTML export next.js projects do not require this plugin **
1:04:57 PM: ​
1:04:57 PM:   Plugin details
1:04:57 PM:   Package:        @netlify/plugin-nextjs
1:04:57 PM:   Version:        1.0.2
1:04:57 PM:   Repository:     git+https://github.com/netlify/netlify-plugin-nextjs.git
1:04:57 PM:   npm link:       https://www.npmjs.com/package/@netlify/plugin-nextjs
1:04:57 PM:   Report issues:  https://github.com/netlify/netlify-plugin-nextjs/issues

I tried:

  1. Adding a next.config.js like this
    • It did not work
  2. Removing the npm run export from the the netlify.toml build command

See the full deployment log and code:
https://app.netlify.com/sites/confettilabs/deploys/5fe08f23bbf52800077cfcb7

What GitHub repo should I start with?

Thanks

@lindsaylevine
Copy link

@gianpaj for the specific repo you linked, remove line 9 from https://github.com/gianpaj/confettilabs/blob/master/package.json#L9

for any repo you start with, don't include any export script in your package.json's list of scripts. this has been fixed in main but not published to npm yet unfortunately

@lindsaylevine
Copy link

just published to npm, pending upgrade here -> netlify/plugins#193

@gianpaj
Copy link

gianpaj commented Dec 21, 2020

@lindsaylevine thanks a lot for the quick reply! removing that fixed the deployment!

serhalp pushed a commit that referenced this issue Apr 5, 2024
* fix: fixes a module interop issue

* chore: bump version

* chore: remove page router support

* chore: update lock file

* tests: currently skip this test as its disabled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants