Closed yuqu closed 3 years ago
If the CLI is executed in an environment with npm 7+ using npx, the plugin cannot start Storybook instance.
npx @zeplin/cli connect npx @zeplin/cli connect initialize npx @zeplin/cli connect add-components
The root cause is due to the following code piece where we detect npm executable https://github.com/zeplin/cli-connect-storybook-plugin/blob/master/src/storybook/start-app.js#L86-L98. npx now has its own executable, detection collects npx-cli.js instead of npm-cli.js and causes npm run storybook to be invoked as npx run storybook
npm run storybook
npx run storybook
Starting: storybook --ci internal/modules/cjs/loader.js:818 throw err; ^ Error: Cannot find module '/Users/yuqu/Playground/example-react-components/storybook' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15) at Function.Module._load (internal/modules/cjs/loader.js:667:27) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) at internal/main/run_main_module.js:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] } events.js:291 throw er; // Unhandled 'error' event ^ Error: read EIO at TTY.onStreamRead (internal/stream_base_commons.js:209:20) Emitted 'error' event on ReadStream instance at: at emitErrorNT (internal/streams/destroy.js:92:8) at emitErrorAndCloseNT (internal/streams/destroy.js:60:3) at processTicksAndRejections (internal/process/task_queues.js:84:21) { errno: 'EIO', code: 'EIO', syscall: 'read' } npm ERR! code 1 npm ERR! path /Users/yuqu/Playground/example-react-components npm ERR! command failed npm ERR! command sh -c runjs "storybook" "--ci" Yucels-MacBook-Pro:example-react-components yuqu$ npm ERR! A complete log of this run can be found in: npm ERR! /Users/yuqu/.npm/_logs/2021-02-08T12_54_46_014Z-debug.log
Fixed in #40
If the CLI is executed in an environment with npm 7+ using npx, the plugin cannot start Storybook instance.
The root cause is due to the following code piece where we detect npm executable https://github.com/zeplin/cli-connect-storybook-plugin/blob/master/src/storybook/start-app.js#L86-L98. npx now has its own executable, detection collects npx-cli.js instead of npm-cli.js and causes
npm run storybook
to be invoked asnpx run storybook