Describe the bug
For the last few weeks, we've been running our Yarn monorepo and deploying consistently without problems. However, as of this morning, we are getting Command "deploy" not found. We haven't changed base directory, publish directory, our netlify.toml nor our build command.
Logs
10:44:35 AM: β― Starting Netlify Build v0.1.84
10:44:35 AM: https://github.com/netlify/build
10:44:35 AM: β
10:44:35 AM: β― Flags
10:44:35 AM: siteId: a89e1d0b-64f4-4433-8eca-7da0f5eea9bd
10:44:35 AM: β
10:44:35 AM: β― Current directory
10:44:35 AM: /opt/build/repo
10:44:35 AM: β
10:44:35 AM: β― Config file
10:44:35 AM: /opt/build/repo/websites/www.deputy.com/netlify.toml
10:44:35 AM: β
10:44:37 AM: β― Loading plugins
10:44:37 AM: - @netlify/plugin-functions-core from build core
10:44:37 AM: β
10:44:37 AM: β― Running Netlify Build Lifecycle
10:44:37 AM: Found 3 commands. Lets do this!
10:44:37 AM:
10:44:37 AM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
10:44:37 AM: β 1. Running onInstall command from @netlify/plugin-functions-core β
10:44:37 AM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
10:44:37 AM: β
10:44:37 AM: β
10:44:37 AM: β @netlify/plugin-functions-core.onInstall completed in 4ms
10:44:37 AM:
10:44:37 AM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
10:44:37 AM: β 2. Running build.lifecycle.onBuild command from netlify.toml config file β
10:44:37 AM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
10:44:37 AM: β
10:44:37 AM: Running command "yarn deploy"
10:44:37 AM: yarn run v1.17.0
10:44:37 AM: error Command "deploy" not found.
10:44:37 AM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
10:44:37 AM: β
10:44:37 AM: βββββββββββββββββββββββββββββββ
10:44:37 AM: β Build failed β
10:44:37 AM: βββββββββββββββββββββββββββββββ
10:44:37 AM: β
10:44:37 AM: β― Error message
10:44:37 AM: Command failed with exit code 1: yarn deployβ
10:44:37 AM: β
10:44:37 AM: β― Error location
10:44:37 AM: In configuration "build.lifecycle.onBuild" command:
10:44:37 AM: yarn deploy
10:44:37 AM: β
10:44:37 AM: βββββββββββββββββββββββββββββββ
10:44:37 AM: β END Build failed β
10:44:37 AM: βββββββββββββββββββββββββββββββ
Okay, so it looks like this might be something to do with the "build plugins" beta that our repo is enabled with. My netlify.toml was like this:
[build]
base = "website/"
publish = "website/dist"
command = "yarn deploy"
And the builds started working again when I changed it to this:
[build]
base = "website/"
publish = "website/dist"
command = "yarn workspace website deploy"
We have another site within the same monorepo setup similar to the first code block above that is not setup for the build plugins beta that built fine without the workspace value. I'm guessing that there was some updates around Yarn and monorepo management that is making the workspace command essential now.
Thanks for reaching out @ksaturnius!
I'm glad you found a work around by using yarn workspace. However I would like to find out what the problem was since this will most likely impact other users with a similar setup.
We just released changes related to monorepos. Those changes might have a bug producing the behavior you are describing. Our intent is that builds that used to work without the Netlify Build beta enabled should work without any modification after enabling it.
Could you please share more information about your setup, if this is possible, such as:
Thanks for your help!
Hey @ehmicky, here's links to a few of the related deploy logs:
The source repository is not public, but the Netlify-related portion is structured as such:
/
yarn.lock
|--websites
| |__www.deputy.com
| | |__netlify.toml
| | |__package.json
| | |__yarn.lock
The rest of that www.deputy.com folder is a normal Nuxt.js folder setup. The yarn.lock within the www.deputy.com is an empty file to trigger Netlify's awareness of using Yarn as per this comment. The Netlify.toml prior to the "workspace" fix noted above was as such:
[build]
command = "yarn deploy"
[context.deploy-preview.environment]
DEPUTY_ENV = "production"
[context.staging.environment]
DEPUTY_ENV = "staging"
[context.production.environment]
DEPUTY_ENV = "production"
[[plugins]]
package = "./build/storyblokFetcher.js"
Build Settings:
Base directory: /websites/www.deputy.com
Build command: yarn deploy
Publish directory: /websites/www.deputy.com/dist
Thanks for all the information @ksaturnius!
I think I found the problem. A fix is now in production. Could you give it a try and let me know if things are working again?
We are currently re-working monorepo support and I accidentally introduced the bug you are reporting: I am very sorry about this.
Did this fix solve your problem @ksaturnius?
@ehmicky I'll try to test this week... been a bit chaotic over here as the whole company has been sent to work from home permanently so there's been lots of scrambling.
@ehmicky gave this a run at the end of the day here with yarn deploy as the command and everything worked as expected π
It's been chaotic here too (I live in Italy), I hope everything is good for you in Sidney @ksaturnius.
Glad this fixed your problem! Please let us know if you have any other issues :)
Yeah, we're doing okay here so far. Hope things are okay over there for you too @ehmicky. Thanks for the speedy turn around/fix.