Skip to content

Commit 2d4fe72

Browse files
committed
fix(mysql): prepend /usr/sbin to path for mysql check on linux
1 parent f56c533 commit 2d4fe72

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/commands/doctor/checks/install.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,13 @@ module.exports = [{
8787
title: 'Checking MySQL is installed',
8888
skip: (ctx) => ctx.local || (ctx.argv && ctx.argv.db === 'sqlite3'),
8989
task: (ctx) => {
90+
// On ubuntu, mysqld is in `/usr/sbin` but it's not automatically in the PATH of non-root users
91+
// So, we modify the path env var to make things work
92+
let options = os.platform() === 'linux' ? {env: {PATH: `/usr/sbin:${process.env.PATH}`}} : {};
93+
9094
// Technically this doesn't work on windows, but there's
9195
// not an easy way to do that anyways so ¯\_(ツ)_/¯
92-
return execa.shell('which mysqld').catch(() => {
96+
return execa.shell('which mysqld', options).catch(() => {
9397
ctx.ui.log(
9498
chalk.yellow(`Local MySQL install not found. You can ignore this if you are using a remote MySQL host.${eol}`) +
9599
chalk.yellow(`Alternatively you could:${eol}`) +

0 commit comments

Comments
 (0)