question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Netlify deploy with build flag uses different directory

See original GitHub issue

Describe the bug

netlify deploy and netlify build commands are working correctly however, doing netlify deploy --build uses a wrong deploy path.

netlify deploy:

Deploy path:        /home/bronze/coding/gold/dist
Configuration path: /home/bronze/coding/gold/netlify.toml

netlify deploy --build

Deploy path:        /home/bronze/coding/gold/astro build
Configuration path: /home/bronze/coding/gold/netlify.toml

Honestly i dont know ehere that astro build is coming from

Steps to reproduce

Tried reverting to version 11.5.1 and everything worked. Caught this discrepancy: 11.6.0

  1. build.command from netlify.toml
────────────────────────────────────────────────────────────────
​$ astro build

11.5.1

 1. build.command from netlify.toml
────────────────────────────────────────────────────────────────
​$ pnpm build || ( npm install pnpm && pnpm build )

I dont even have astro build on my netlify.toml. Changed the command on my package.json too and it didnt change, so im not sure where it is getting this command from.

Configuration

[build.environment]
  NODE_VERSION = "16"

[build]
  publish = "dist"
  command = "pnpm build || ( npm install pnpm && pnpm build )"

[dev]
  autoLaunch = false
  command = "pnpm run dev"

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

Environment

  System:
    OS: Linux 5.10 Ubuntu 20.04.4 LTS (Focal Fossa)
    CPU: (12) x64 AMD Ryzen 5 3600X 6-Core Processor
    Memory: 21.98 GB / 25.02 GB
    Container: Yes
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v16.13.0/bin/yarn
    npm: 8.19.1 - ~/.nvm/versions/node/v16.13.0/bin/npm
  npmGlobalPackages:
    netlify-cli: 11.6.0

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tinfoil-knightcommented, Sep 24, 2022

@bronze

Closing this as it has been resolved in https://github.com/netlify/cli/pull/5084.

Please update the Netlify CLI package to v11.8.3.


Thank you @sarahetter for the super-quick fix.

1reaction
tinfoil-knightcommented, Sep 23, 2022

@dariodevito Thank you for finding out the potential cause. I debugged @bronze’s site independently & found the issue occurring at the mentioned line.


@sarahetter This issue seems to be originating in this PR: https://github.com/netlify/cli/pull/5029

The publish variable (which originally had the location of the build directory) is being overwritten by the build command.

Could you please take a look?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build configuration overview - Netlify Docs
Reference basic build settings for a repository using continuous deployment, and understand build image options for your site.
Read more >
File-based configuration - Netlify Docs
The netlify.toml is a configuration file that specifies how Netlify builds and deploys your site β€” including redirects, branch and context-specific settings,Β ...
Read more >
Manage build dependencies | Netlify Docs
Specify dependencies for your project so that our platform can install required languages and software before running a build.
Read more >
Get started with Netlify CLI
You can use Netlify CLI to run a local development server that you can share with others, run a local build and plugins,...
Read more >
Optional configuration for functions - Netlify Docs
Netlify will access the functions directory during every build, preparing and deploying each supported code file as a function. The default directory isΒ ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found