Skip to content

Commit

Permalink
Fix process.env.npm_execpath issue
Browse files Browse the repository at this point in the history
  • Loading branch information
yuqu committed Jun 9, 2021
1 parent 81209bc commit 06b899a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/storybook/start-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,12 @@ export async function startApp({ scriptName, commandName, args, url, inheritStdi
}

// This technique lifted from https://github.com/mysticatea/npm-run-all/blob/52eaf86242ba408dedd015f53ca7ca368f25a026/lib/run-task.js#L156-L174
const npmPath = process.env.npm_execpath
const npmPath = typeof process.env.npm_execpath === 'string' ?
// Replace npx-cli.js with npm-cli.js
// hacky but resolves the problem until we can refactor this file
// https://github.com/zeplin/cli-connect-storybook-plugin/issues/38
.replace("npx-cli.js", "npm-cli.js");
process.env.npm_execpath.replace("npx-cli.js", "npm-cli.js")
: undefined;

const npmPathIsJs = typeof npmPath === 'string' && /\.m?js/.test(path.extname(npmPath));
const isYarn = typeof npmPath === 'string' && /^yarn(\.js)?$/.test(path.basename(npmPath));
Expand Down

0 comments on commit 06b899a

Please sign in to comment.