Base directory incorrect for monorepos
See original GitHub issueIt looks like the build.command
is running in the root directory versus the build.base
directory.
https://app.netlify.com/sites/monorepo-base-dir-repro/deploys/5e1f844ba0553600078e5594
This repro repo was reported by a user trying build plugins. He was only able to get them working without a mono repo setup.
https://github.com/DavidWells/netlify-build-mono-repo-base-dir
It seems like we need to detect if build.base
exists and then use that as cwd
when executing any commands (e.g. build.command: npm run x, utils.run(βthingβ), or build.lifecycle.xyz: npm run foo)
Inside the website
dir we have an npm script βnetlifyβ https://github.com/DavidWells/netlify-build-mono-repo-base-dir/blob/9c366e1766f86eeb5133b494e3c5a33bdb1bee4d/website/package.json#L18
This is not found. Build logs:
1:30:26 PM:
1:30:26 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
1:30:26 PM: β 3. Running build.lifecycle.onBuild command from netlify.toml config file β
1:30:26 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
1:30:26 PM:
1:30:26 PM: Running command "npm run netlify"
1:30:27 PM: npm ERR! missing script: netlify
1:30:27 PM: npm ERR! A complete log of this run can be found in:
1:30:27 PM: npm ERR! /opt/buildhome/.npm/_logs/2020-01-15T21_30_27_020Z-debug.log
1:30:27 PM:
1:30:27 PM: βββββββββββββββββββββββββββββββ
1:30:27 PM: β Netlify Build Error β
1:30:27 PM: βββββββββββββββββββββββββββββββ
1:30:27 PM: In "onBuild" command "npm run netlify":
1:30:27 PM: Command failed with exit code 1: npm run netlify
Let me know if you need additional context π
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Iβm still digging into this - Iβm not sure how or where the directory is being changed between https://github.com/netlify/buildbot/blob/master/script/run-build.sh#L26, where the current directory is correct, and https://github.com/netlify/buildbot/blob/master/script/run-build.sh#L81, where it isnβt. Iβll update here and at https://github.com/netlify/buildbot/issues/569 when Iβve tracked this down.
This is fixed now! π