cli icon indicating copy to clipboard operation
cli copied to clipboard

[v17.36.2]: Running into "Multiple possible build commands found" with builds disabled

Open gfellerph opened this issue 1 year ago • 5 comments

Describe the bug

We're building our static page in a GitHub Action and deploy just the .zip. Therefore we disabled builds on netlify. Since the 20th of September 2024, our netlify deploy command fails with the error (https://github.com/swisspost/design-system/actions/runs/11066480112/job/30747794144):

Multiple possible build commands found
 ›   Error: Detected commands for: Hydrogen, Remix. Update your settings to specify which to use. Refer to https://ntl.fyi/dev-monorepo for more information.

However, our deploy command should disable builds:

netlify deploy --filter @swisspost/design-system-documentation --build false --dir ${{ steps.build.outputs.folder }} --alias $url_alias

Also, in the changelog there is a feature entry that does not seem to belong to any version (https://github.com/netlify/cli/blob/main/CHANGELOG.md#17362-2024-09-20).

image

Steps to reproduce

See build command and linked action runs above.

Configuration

https://github.com/swisspost/design-system/blob/main/packages/documentation/netlify.config.json

Environment

Not easy since we're installing the netlify cli only for action runs. I hope the information above is enough.

gfellerph avatar Sep 27 '24 08:09 gfellerph

I have the same problem, and I cannot downgrade the versions of the Netlify CLI.

Moreover, the link in this error does not help to fix the problem.

Multiple possible build commands found › Error: Detected commands for: Hydrogen, Remix. Update your settings to specify which to use. Refer to https://ntl.fyi/dev-monorepo for more information.

what1s1ove avatar Oct 06 '24 17:10 what1s1ove

Same issue here.

In our open source repository https://github.com/nolebase/integrations , we have a custom GitHub Actions manifest running with the following command:

netlify deploy --dir 'docs/.vitepress/dist' --prod --debug

which will produce:

Multiple possible build commands found
 ›   Warning: Error: Detected commands for: Hydrogen, Remix. Update your settings to specify which to use. Refer to https://ntl.fyi/dev-monorepo for more information.
 ›       at detectFrameworkSettings (file:///home/runner/setup-pnpm/node_modules/.bin/global/5/.pnpm/[email protected]_@[email protected]/node_modules/netlify-cli/dist/utils/build-info.js:71:19)
 ›       at async deploy (file:///home/runner/setup-pnpm/node_modules/.bin/global/5/.pnpm/[email protected]_@[email protected]/node_modules/netlify-cli/dist/commands/deploy/deploy.js:642:22)
 ›       at async BaseCommand.<anonymous> (file:///home/runner/setup-pnpm/node_modules/.bin/global/5/.pnpm/[email protected]_@[email protected]/node_modules/netlify-cli/dist/commands/deploy/index.js:105:5)
 ›       at async BaseCommand.parseAsync (/home/runner/setup-pnpm/node_modules/.bin/global/5/.pnpm/[email protected]/node_modules/commander/lib/command.js:935:5)
 ›       at async file:///home/runner/setup-pnpm/node_modules/.bin/global/5/.pnpm/[email protected]_@[email protected]/node_modules/netlify-cli/bin/run.js:27:3

nekomeowww avatar Oct 09 '24 06:10 nekomeowww

Is there any workaround?

zanhk avatar Oct 13 '24 09:10 zanhk

Is there any workaround?

Yes, just pin the cli to the latest working version for now…

peschee avatar Oct 13 '24 09:10 peschee

Ok thanks

zanhk avatar Oct 13 '24 09:10 zanhk

Any update on this issue? Hitting the same thing.

My netlify.toml file:

[build]
  publish = ".wasp/build/web-app/build/"

[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200
  force = false%    

infomiho avatar Dec 13 '24 15:12 infomiho

This has been impacting my deploys lately also.

Experimentation showed that removing config.toml in the top level folder avoided this misfeature. I use Hugo to build the site, and the standard name of the config has changed in recent Hugo versions to hugo.toml (or yaml, ... ). Changing the name of the config file to hugo.toml works around the issue for me.

crisperdue avatar Jan 18 '25 23:01 crisperdue

I ran into this issue too

hjylewis avatar Apr 16 '25 17:04 hjylewis

I found if you add this to your netlify.toml

[build]
command = "exit 0"

you avoid the error

hjylewis avatar Apr 16 '25 20:04 hjylewis

@hjylewis thanks, that will make the original issue disappear.

However, haven't managed to get anything working with 20.0.2, not sure if this is partially because of the command now.

I'm mainly running into ERROR: Could not resolve "tslib", using just the netlify deploy command after having build my application via Nuxt first into the dist directory.

Was running into that issue previously as well, but could workaround that using the netlify deploy --build flag. This won't work anymore and leads to similar issues regarding tslib

⠧ Hashing _nuxt\3zS2CfTW.js​
Bundling of function "server" failed
────────────────────────────────────────────────────────────────
​
  Error message
  Build failed with 180 errors:
  .netlify/functions-internal/server/node_modules/echarts/lib/chart/bar/BarSeries.js:44:26: ERROR: Could not resolve "tslib"
  .netlify/functions-internal/server/node_modules/echarts/lib/chart/bar/BarView.js:44:26: ERROR: Could not resolve "tslib"
  .netlify/functions-internal/server/node_modules/echarts/lib/chart/bar/BaseBarSeries.js:44:26: ERROR: Could not resolve "tslib"
  .netlify/functions-internal/server/node_modules/echarts/lib/chart/bar/PictorialBarSeries.js:44:26: ERROR: Could not resolve "tslib"
  .netlify/functions-internal/server/node_modules/echarts/lib/chart/bar/PictorialBarView.js:44:26: ERROR: Could not resolve "tslib"
  ...
​
  Error location
  While bundling function "server"

No idea what is wrong, but I guess some of us are stuck on v17.36.2 forever

mklueh avatar Apr 21 '25 06:04 mklueh

Same issue for me, I am using netlify deploy --prod --dir dist --auth $TOKEN --site $SITE_ID. No build command, no --build option. That's pure nonsense.

The situation is:

  • src/commands/deploy.index.ts#L112 : the --build flag is false by default
  • src/commands/deploy/deploy.ts#804 : the deploy function, invoked by the command, calls a function detectFrameworkSettings(command, 'build'), regardless of whether or not the --build flag is present or not
  • src/utils/build-info.ts#L67 : this function then calls detectBuildSettings(command) and stores the result in a settings array
  • (some operations are performed to detect possible build commands, I do not care what happens here)
  • src/utils/build-info.ts#L88 : and eventually, detectFrameworkSettings throws because settings is length 2 or more

My opinion is that netlify-cli should not even try to detect anything related to my project since I did NOT trigger a build, I just want to push-deploy my already build project.

The joke is that const settings = await detectFrameworkSettings(command, 'build') is only used within an if (option.build) block!

We shall just move this call into the block, problem solved.

Florian-Mt avatar Apr 22 '25 19:04 Florian-Mt

Thanks so much for the investigation and the fix @Florian-Mt!

It looks like this may have regressed when that detection was introduced to the deploy command in https://github.com/netlify/cli/commit/111967cc13f8524eb7e3726e1815801ccc5e0133 (v17.33.4, although interestingly folks in this thread are using v17.36.2 successfully...).

serhalp avatar Apr 23 '25 18:04 serhalp

This should be fixed in v20.0.4. Can anyone here confirm? npm i -g netlify-cli@latest

Thanks!

serhalp avatar Apr 24 '25 18:04 serhalp

Yes, it works for me, thank you for publishing the fix.

Florian-Mt avatar Apr 24 '25 18:04 Florian-Mt

I found if you add this to your netlify.toml

[build]
command = "exit 0"

you avoid the error

@serhalp @Florian-Mt but can this be considered a real fix for the original problem, or rather a fix to make the hackaround work?

I feel like putting command = "exit 0" into every project of my monorepo feels like creating unnecessary mess, just to prevent an error that shouldn't even exist.

Imo this should be handled by the CLI

mklueh avatar Apr 25 '25 06:04 mklueh

I wasted half a day trying to overcome this issue. Issue is present in v20.1.1 but not in v20.1.0

npm i -g [email protected] solves the issue

goastler avatar Apr 28 '25 18:04 goastler

@mklueh

@serhalp @Florian-Mt but can this be considered a real fix for the original problem, or rather a fix to make the hackaround work?

I feel like putting command = "exit 0" into every project of my monorepo feels like creating unnecessary mess, just to prevent an error that shouldn't even exist.

Imo this should be handled by the CLI

I think there's been a misunderstanding here. This is the fix. What you're referencing was a proposed workaround prior to the fix.

Are you using the latest netlify-cli and still needing the workaround? If so, could you please open a new issue? It sounds like that would be a separate issue.

serhalp avatar Apr 28 '25 18:04 serhalp

@goastler

I wasted half a day trying to overcome this issue. Issue is present in v20.1.1 but not in v20.1.0

Are you referring to the original issue in this thread, related to running netlify deploy without --build? If not, can you please open a new issue with reproduction steps?

Either way, could you share your stack (framework/bundler) and the full error message?

Thank you!

serhalp avatar Apr 28 '25 18:04 serhalp

NETLIFY_AUTH_TOKEN=<token> npx netlify deploy --site 2da... --dir ./dist --message "local deploy from g-lt1"

If I run this using v20.1.1, I get "Multiple possible build commands found". v20.1.0 on the other hand works as expected, no problem

goastler avatar Apr 28 '25 19:04 goastler

I just ran it again and it still works for me in 20.1.1. You may use --debug to get more information. However, I agree with @serhalp, you should open a new issue as it looks like it is a different problem.

Florian-Mt avatar Apr 28 '25 19:04 Florian-Mt

@goastler can you please run this (from the same directory) and share the output?

npx @netlify/build-info

serhalp avatar Apr 28 '25 21:04 serhalp