描述bug
当我运行Storybook开发脚本时,遇到了一个ENOENT错误,错误信息为"NONE"。这个错误是由于我的环境变量BROWSER被设置为"NONE"导致的。然而,如果process.env.BROWSER的值无效,却没有抛出警告或错误。
重现步骤
运行BROWSER="NONE" npx storybook dev
系统信息
Environment Info:
System:
OS: Linux 5.15 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
CPU: (8) x64 Intel(R) Core(TM) i7-10610U CPU @ 1.80GHz
Binaries:
Node: 18.16.1 - ~/.nvm/versions/node/v18.16.1/bin/node
npm: 9.5.1 - ~/.nvm/versions/node/v18.16.1/bin/npm
Browsers:
Chrome: 110.0.5481.100
npmPackages:
@storybook/addon-essentials: ^7.2.3 => 7.3.0
@storybook/addon-interactions: ^7.2.3 => 7.3.0
@storybook/addon-links: ^7.2.3 => 7.3.0
@storybook/addon-styling: ^1.3.6 => 1.3.7
@storybook/blocks: ^7.2.3 => 7.3.0
@storybook/builder-vite: ^7.2.3 => 7.3.0
@storybook/react-vite: ^7.3.0 => 7.3.0
@storybook/testing-library: ~0.2.0 => 0.2.0
附加上下文
node:events:491 throw er; // Unhandled 'error' event ^ Error: spawn NONE ENOENT at __node_internal_captureLargerStackTrace (node:internal/errors:490:5) at __node_internal_errnoException (node:internal/errors:620:12) at ChildProcess._handle.onexit (node:internal/child_process:283:19) at onErrorNT (node:internal/child_process:476:16) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) Emitted 'error' event on ChildProcess instance at: at ChildProcess._handle.onexit (node:internal/child_process:289:12) at onErrorNT (node:internal/child_process:476:16) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { errno: -2, code: 'ENOENT', syscall: 'spawn NONE', path: 'NONE', spawnargs: [ 'http://localhost:45713/' ] }
3条答案
按热度按时间fsi0uk1n1#
与
BROWSER=none
相同(小写):如何防止storybook打开浏览器?!?
6qqygrtg2#
我目前的解决方法是:
然后运行
/bin/true
而不是浏览器,它只返回成功...wkyowqbh3#
我确认@mwaeckerlin的建议是可行的。