Can't find the dash-generate-components command

I would like to contribute on dash-core-components but when I run npm run build it shows an error when it runs the script

"build:py_and_r": "dash-generate-components ./src/components dash_core_components -p"

it says that sh: 1: dash-generate-components: not found

:smiley:

Have you got dash installed? dash-generate-components is a command line tool owned by dash.

No I didn’t and I’m not sure what are the exact steps to do it. I just follow the contribution guide. Do you know the exact process of running it locally?

If you have Python and PIP installed you can just do

pip install dash

I guess whoever wrote the guide might have just assumed that people modifying dash-core-components would have dash installed for testing purposes?

1 Like

Yeah maybe. Thank you. :+1:

Do I need to install dash-core-components because when I do npm run build I get this error

> dash-core-components@0.48.0 build /home/qrs/Programming/Community/dash-core-components
> npm run build:js && npm run build:py_and_r


> dash-core-components@0.48.0 build:js /home/qrs/Programming/Community/dash-core-components
> webpack --mode production

Hash: 0cd038d197db109352aa
Version: webpack 4.29.6
Time: 13418ms
Built at: 06/18/2019 3:08:49 PM
                          Asset      Size  Chunks                    Chunk Names
    dash_core_components.min.js  1.06 MiB       0  [emitted]  [big]  main
dash_core_components.min.js.map  3.76 MiB       0  [emitted]         main
Entrypoint main [big] = dash_core_components.min.js dash_core_components.min.js.map
  [0] external "PropTypes" 42 bytes {0} [built]
  [1] external "React" 42 bytes {0} [built]
 [11] external "ReactDOM" 42 bytes {0} [built]
[109] (webpack)/buildin/global.js 472 bytes {0} [built]
[453] ./node_modules/react-portal/es/index.js + 5 modules 11.3 KiB {0} [built]
      |    6 modules
[864] (webpack)/buildin/module.js 497 bytes {0} [built]
[865] ./node_modules/moment/locale sync ^\.\/.*$ 3 KiB {0} [optional] [built]
[933] ./src/index.js + 77 modules 481 KiB {0} [built]
      | ./src/index.js 1.54 KiB [built]
      | ./src/fragments/Loading/spinners/GraphSpinner.jsx 12.1 KiB [built]
      | ./src/fragments/Loading/spinners/DefaultSpinner.jsx 4.25 KiB [built]
      | ./src/fragments/Loading/spinners/CubeSpinner.jsx 7.96 KiB [built]
      | ./src/fragments/Loading/spinners/CircleSpinner.jsx 9.05 KiB [built]
      | ./src/fragments/Loading/spinners/DotSpinner.jsx 3.38 KiB [built]
      | ./src/utils/convertToMoment.js 527 bytes [built]
      |     + 71 hidden modules
    + 926 hidden modules

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets: 
  dash_core_components.min.js (1.06 MiB)

WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  main (1.06 MiB)
      dash_core_components.min.js


WARNING in webpack performance recommendations: 
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/

> dash-core-components@0.48.0 build:py_and_r /home/qrs/Programming/Community/dash-core-components
> dash-generate-components ./src/components dash_core_components -p package-info.json --r-prefix 'dcc'


Description for RangeSlider.tooltip is missing!

Description for Slider.tooltip is missing!

Generated Checklist.py
Generated dccChecklist.R
Generated ConfirmDialog.py
Generated dccConfirmDialog.R
Generated ConfirmDialogProvider.py
Generated dccConfirmDialogProvider.R
Generated DatePickerRange.py
Generated dccDatePickerRange.R
Generated DatePickerSingle.py
Generated dccDatePickerSingle.R
Generated Dropdown.py
Generated dccDropdown.R
Generated Graph.py
Generated dccGraph.R
Generated Input.py
Generated dccInput.R
Generated Interval.py
Generated dccInterval.R
Generated Link.py
Generated dccLink.R
Generated Loading.py
Generated dccLoading.R
Generated Location.py
Generated dccLocation.R
Generated LogoutButton.py
Generated dccLogoutButton.R
Generated Markdown.py
Generated dccMarkdown.R
Generated RadioItems.py
Generated dccRadioItems.R
Generated RangeSlider.py
Generated dccRangeSlider.R
Generated Slider.py
Generated dccSlider.R
Generated Store.py
Generated dccStore.R
Generated Tab.py
Generated dccTab.R
Generated Tabs.py
Generated dccTabs.R
Generated Textarea.py
Generated dccTextarea.R
Generated Upload.py
Generated dccUpload.R
Traceback (most recent call last):
  File "/home/qrs/anaconda3/envs/dash_env/bin/dash-generate-components", line 12, in <module>
    sys.exit(cli())
  File "/home/qrs/anaconda3/envs/dash_env/lib/python3.7/site-packages/dash/development/component_generator.py", line 143, in cli
    rprefix=args.r_prefix)
  File "/home/qrs/anaconda3/envs/dash_env/lib/python3.7/site-packages/dash/development/component_generator.py", line 105, in generate_components
    project_shortname, components, metadata, pkg_data, prefix
  File "/home/qrs/anaconda3/envs/dash_env/lib/python3.7/site-packages/dash/development/_r_components_generation.py", line 581, in generate_exports
    export_string
  File "/home/qrs/anaconda3/envs/dash_env/lib/python3.7/site-packages/dash/development/_r_components_generation.py", line 497, in generate_rpkg
    project_shortname=project_shortname
  File "/home/qrs/anaconda3/envs/dash_env/lib/python3.7/site-packages/dash/development/_r_components_generation.py", line 399, in write_js_metadata
    project_shortname=project_shortname
  File "/home/qrs/anaconda3/envs/dash_env/lib/python3.7/site-packages/dash/development/_r_components_generation.py", line 237, in generate_js_metadata
    importlib.import_module(project_shortname)
  File "/home/qrs/anaconda3/envs/dash_env/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'dash_core_components'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! dash-core-components@0.48.0 build:py_and_r: `dash-generate-components ./src/components dash_core_components -p package-info.json --r-prefix 'dcc'`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the dash-core-components@0.48.0 build:py_and_r script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/qrs/.npm/_logs/2019-06-18T07_08_55_040Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! dash-core-components@0.48.0 build: `npm run build:js && npm run build:py_and_r`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the dash-core-components@0.48.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/qrs/.npm/_logs/2019-06-18T07_08_55_206Z-debug.log

For people intrigued by this thread.

this snippet code in setup.py tells why you need to pip install dash. In fact dash-generate-components is just an alias entry point to dash.development.component_generator:cli.

    entry_points={
        "console_scripts": [
            "dash-generate-components ="
            " dash.development.component_generator:cli"
        ],

Do we need to include dash in dev-requirements.txt file ?

can you be more specific on the context? the dev-requirements.txt in .circleci or your own version for dash app?

The dev-requirements.txt. I posted here the steps that I’ve done and the error that I get. I’m still trying to figure out what I missed.

It’s ok now after reinstalling dash with v1.0.0.

2 Likes

Hello,

I have the same problem. I have tried both the latest version of dash and version 1.0.0, and have all those installed via conda. I can find the dash-generate-components file in the Scripts folder, which is in PATH, but cannot call it from the command prompt.

Were you able to find the solution?