From 62c8cc0ec84401b842e2663d0e72ac301bba898b Mon Sep 17 00:00:00 2001 From: MU AOHUA Date: Sat, 26 Jan 2019 05:02:27 +0800 Subject: [PATCH] fix: yarn detection with nps (#441) --- packages/cli/src/api/help.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/api/help.js b/packages/cli/src/api/help.js index 753294a93..96a8b9908 100644 --- a/packages/cli/src/api/help.js +++ b/packages/cli/src/api/help.js @@ -25,5 +25,7 @@ try { } catch (e) { commands = ["run"] } -const isYarn = process.env.npm_config_user_agent.includes("yarn") +const isYarn = + process.env.npm_config_user_agent && + process.env.npm_config_user_agent.includes("yarn") const preCommand = [isYarn ? "yarn" : "npm", ...commands].join(" ")