gradio: Custom Component : cc gradio build Error
Describe the bug
Issue : gradio cc build returns and error in windows
itโs impossible to build my custom component !
Ref :
https://github.com/MedTonic/Gradio-Seq-Diff
Have you searched existing issues? ๐
- I have searched and found no existing issues
Reproduction
git clone https://github.com/MedTonic/Gradio-Seq-Diff
cd gradio-seq-diff
gradio cc build
Screenshot
ValueError: Could not find `@gradio/preview`. Run `npm i -D @gradio/preview` in your frontend folder.
running the command doesnt remove the error
Logs
MeMyself@DESKTOP-BA808PC MINGW64 ~/seq_diff (main)
$ gradio cc build
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ ๐ฆ Building package in seq_diff โ
โ ๐ข Package will use version 0.0.2 defined in pyproject.toml file. Set --bump-version to automatically bump the โ
โ version number. โ
โ โ
Documentation generated in demo\space.py and README.md. Pass --no-generate-docs to disable auto documentation. โ
โ โ
โ ๐ The docs were generated in simple mode. Updating python to a version greater than 3.9 will result in richer โ
โ documentation. โ
โ ๐จ Building frontend โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Traceback (most recent call last) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ C:\Python312\Lib\site-packages\gradio\cli\commands\components\build.py:140 in _build โ
โ โ
โ 137 โ โ โ ) โ
โ 138 โ โ โ โ
โ 139 โ โ โ if gradio_node_path.returncode != 0: โ
โ โฑ 140 โ โ โ โ raise ValueError( โ
โ 141 โ โ โ โ โ "Could not find `@gradio/preview`. Run `npm i -D @gradio/preview` in โ
โ 142 โ โ โ โ ) โ
โ 143 โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ _demo_dir = WindowsPath('C:/Users/MeMyself/seq_diff/demo') โ โ
โ โ _demo_name = 'app.py' โ โ
โ โ _demo_path = WindowsPath('C:/Users/MeMyself/seq_diff/demo/app.py') โ โ
โ โ _readme_path = WindowsPath('C:/Users/MeMyself/seq_diff/README.md') โ โ
โ โ build_frontend = True โ โ
โ โ bump_version = False โ โ
โ โ component_directory = WindowsPath('C:/Users/MeMyself/seq_diff') โ โ
โ โ generate_docs = True โ โ
โ โ gradio_node_path = CompletedProcess(args=['C:\\Program Files\\nodejs\\node.EXE', '-e', โ โ
โ โ "console.log(require.resolve('@gradio/preview'))"], returncode=1, stdout=b'', โ โ
โ โ stderr=b'node:internal/modules/cjs/loader:641\r\n throw e;\r\n ^\r\n\r\nError โ โ
โ โ [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in โ โ
โ โ C:\\Users\\MeMyself\\seq_diff\\frontend\\node_modules\\@gradio\\preview\\package.json\r\n โ โ
โ โ at exportsNotFound (node:internal/modules/esm/resolve:304:10)\r\n at โ โ
โ โ packageExportsResolve (node:internal/modules/esm/resolve:594:13)\r\n at resolveExports โ โ
โ โ (node:internal/modules/cjs/loader:634:36)\r\n at Module._findPath โ โ
โ โ (node:internal/modules/cjs/loader:724:31)\r\n at Module._resolveFilename โ โ
โ โ (node:internal/modules/cjs/loader:1211:27)\r\n at Function.resolve โ โ
โ โ (node:internal/modules/helpers:190:19)\r\n at [eval]:1:21\r\n at โ โ
โ โ runScriptInThisContext (node:internal/vm:209:10)\r\n at โ โ
โ โ node:internal/process/execution:118:14\r\n at [eval]-wrapper:6:24 {\r\n code: โ โ
โ โ \'ERR_PACKAGE_PATH_NOT_EXPORTED\'\r\n}\r\n\r\nNode.js v20.17.0\r\n') โ โ
โ โ live = <gradio.cli.commands.display.LivePanelDisplay object at 0x000001E455D4DC70> โ โ
โ โ name = WindowsPath('C:/Users/MeMyself/seq_diff') โ โ
โ โ node = 'C:\\Program Files\\nodejs\\node.EXE' โ โ
โ โ package_name = 'gradio_seq_diff' โ โ
โ โ path = WindowsPath('.') โ โ
โ โ pyproject_toml = {'build-system': {'requires': ['hatchling', 'hatch-requirements-txt', โ โ
โ โ 'hatch-fancy-pypi-readme>=22.5.0'], 'build-backend': 'hatchling.build'}, 'project': โ โ
โ โ {'name': 'gradio_seq_diff', 'version': '0.0.2', 'description': 'Visualize Sequences and โ โ
โ โ their Diffs Using MSAplot', 'readme': 'README.md', 'license': 'mit', 'requires-python': โ โ
โ โ '>=3.9', 'authors': [{'name': 'Joseph Tonic Pollack', 'email': 'joseph.pollack@emle.eu'}], โ โ
โ โ 'keywords': ['gradio-custom-component', 'gradio-template-Image', 'seq', 'sequence', โ โ
โ โ 'multiple sequence alignment', 'MSA', 'seqlogo', 'histogram', 'consensus', 'pyplot', โ โ
โ โ 'MSAplot', 'annotation'], 'dependencies': ['gradio>=5.0', 'numpy', 'pillow', 'matplotlib', โ โ
โ โ 'pandas', 'seaborn'], 'classifiers': ['Development Status :: 3 - Alpha', 'Operating System โ โ
โ โ :: OS Independent', 'Programming Language :: Python :: 3', 'Programming Language :: Python โ โ
โ โ :: 3 :: Only', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: โ โ
โ โ 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', โ โ
โ โ 'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering :: Artificial โ โ
โ โ Intelligence', 'Topic :: Scientific/Engineering :: Visualization'], 'repository': โ โ
โ โ 'https://github.com/MedTonic/Gradio-Seq-Diff', 'optional-dependencies': {'dev': ['build', โ โ
โ โ 'twine']}}, 'tool': {'hatch': {'build': {'artifacts': โ โ
โ โ ['/backend/gradio_seq_diff/templates', '*.pyi'], 'targets': {'wheel': {'packages': โ โ
โ โ ['/backend/gradio_seq_diff']}}}}}} โ โ
โ โ python_path = 'C:\\Users\\MeMyself\\AppData\\Local\\Microsoft\\WindowsApps\\python3.EXE' โ โ
โ โ version = '0.0.2' โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
ValueError: Could not find `@gradio/preview`. Run `npm i -D @gradio/preview` in your frontend folder.
System Info
Gradio Environment Information:
------------------------------
Operating System: Windows
gradio version: 5.0.0b3
gradio_client version: 1.4.0b2
------------------------------------------------
gradio dependencies in your environment:
aiofiles: 23.2.1
anyio: 4.3.0
fastapi: 0.108.0
ffmpy: 0.3.2
gradio-client==1.4.0-beta.2 is not installed.
httpx: 0.27.0
huggingface-hub: 0.24.7
jinja2: 3.1.4
markupsafe: 2.1.5
numpy: 1.26.4
orjson: 3.10.1
packaging: 24.0
pandas: 2.2.2
pillow: 10.3.0
pydantic: 2.9.1
pydub: 0.25.1
python-multipart: 0.0.9
pyyaml: 6.0.1
ruff: 0.4.0
semantic-version: 2.10.0
tomlkit==0.12.0 is not installed.
typer: 0.12.5
typing-extensions: 4.12.2
urllib3: 2.2.1
uvicorn: 0.25.0
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.
gradio_client dependencies in your environment:
fsspec: 2024.2.0
httpx: 0.27.0
huggingface-hub: 0.24.7
packaging: 24.0
typing-extensions: 4.12.2
websockets: 11.0.3
Severity
Blocking usage of gradio
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (5 by maintainers)
Apologies. There is a workaround while we fix this that will enable you to run build/dev. Will share when Iโm back at a computer.
Hi folks, we just merged in @Col0ringโs PR to fix this issue. Can you try installing
gradiofrommain:We will also release Gradio 4.44.1 with this fix.
Update the
@gradio/previewversion to0.11.2is enough to resolve this issue. Your error seems to be another one, you may need to check thepackage.jsonof your custom component and verify the fieldexports.exampleis a string.I have met the same error. Just edit
frontend/package.jsonand change@gradio/previewversion to0.10.1can resolve this.ๆจ็้ฎไปถๅทฒๆถๅฐ๏ผๆไผๅฐฝๅฟซๅค็~ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย by ๅๅทๅคงๅญฆ่ฎก็ฎๆบๅญฆ้ข้ป่ช่ช