Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error generating metadata in test_component (status=255) #102

Open
Mark-Abadir opened this issue Jun 15, 2020 · 5 comments
Open

Error generating metadata in test_component (status=255) #102

Mark-Abadir opened this issue Jun 15, 2020 · 5 comments

Comments

@Mark-Abadir
Copy link

Mark-Abadir commented Jun 15, 2020

Hello,
I have been having an issue with the dash component boilerplate not generating my components. When I execute

npm run build

It generates the following error

`Error generating metadata in test_component (status=255)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test_component@0.0.1 build:py_and_r: dash-generate-components ./src/lib/components test_component -p package-info.json --r-prefix ''
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test_component@0.0.1 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! C:\Users\mabadir\AppData\Roaming\npm-cache_logs\2020-06-15T15_43_13_527Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test_component@0.0.1 build: npm run build:js && npm run build:py_and_r
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test_component@0.0.1 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! C:\Users\mabadir\AppData\Roaming\npm-cache_logs\2020-06-15T15_43_13_559Z-debug.log

To test whether this was something that was wrong with my javascript, I ran the cookiecutter command again in a new python project to create a new component. For set up I selected the following

You've downloaded C:\Users\mabadir.cookiecutters\dash-component-boilerplate before. Is it okay to delete and re-download it? [yes]:
project_name [my dash component]: Test Component
project_shortname [test_component]:
component_name [TestComponent]:
r_prefix []:
author_name [Enter your first and last name (For package.json)]: MA
author_email [Enter your email (For package.json)]: ma
github_org []:
description [Project Description]: testing
Select license:
1 - MIT License
2 - BSD License
3 - ISC License
4 - Apache Software License 2.0
5 - GNU General Public License v3
6 - Not open source
Choose from 1, 2, 3, 4, 5, 6 [1]:
publish_on_npm [True]: False
install_dependencies [True]:
Executing: c:\python38\python.exe -m venv venv

From there I tried npm run build on the example javascript component provided, and it still gave me the above error. Can you please advise?

Edit: Forgot to mention that it was working before.

@alexcjohnson
Copy link
Collaborator

Thanks @Mark-Abadir - is there any more to the error message than that? Can you describe your environment? I just ran a plain cookiecutter https://github.com/plotly/dash-component-boilerplate.git followed by npm run build on my mac, and it all seemed to work fine, but I could certainly imagine there being platform-specific issues.

@RobAlonzi
Copy link

This happens to me as well, running a brand new cookiecutter https://github.com/plotly/dash-component-boilerplate.git followed by npm run build

Webpack seems to be outputting normally:

webpack --mode production
Hash: ef69a9576f2095a97ace
Version: webpack 4.36.1
Time: 492ms
Built at: 06/22/2020 1:14:17 AM
Asset Size Chunks Chunk Names
test_proj.min.js 3.16 KiB 0 [emitted] main
test_proj.min.js.map 7.38 KiB 0 [emitted] main
Entrypoint main = test_proj.min.js test_proj.min.js.map
[0] external "PropTypes" 42 bytes {0} [built]
[1] external "React" 42 bytes {0} [built]
[2] ./src/lib/index.js + 1 modules 5.04 KiB {0} [built]
| ./src/lib/index.js 122 bytes [built]
| + 1 hidden module

This seems to error out:

test_proj@0.0.1 build:py_and_r /media/data/Dev/Projects/dash-hello-world/test_proj
dash-generate-components ./src/lib/components test_proj -p package-info.json --r-prefix 'r_'

Traceback (most recent call last):
File "/home/rob/.local/bin/dash-generate-components", line 11, in
sys.exit(cli())
File "/home/rob/.local/lib/python2.7/site-packages/dash/development/component_generator.py", line 194, in cli
rsuggests=args.r_suggests,
File "/home/rob/.local/lib/python2.7/site-packages/dash/development/component_generator.py", line 90, in generate_components
metadata = safe_json_loads(out.decode("utf-8"))
File "/home/rob/.local/lib/python2.7/site-packages/dash/development/component_generator.py", line 132, in safe_json_loads
jsondata_unicode = json.loads(s, object_pairs_hook=OrderedDict)
File "/usr/lib/python2.7/json/init.py", line 352, in loads
return cls(encoding=encoding, **kw).decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")

ValueError: No JSON object could be decoded

Looks like some JSON is missing? I am running on Ubuntu 18.04.4 LTS

@RobAlonzi
Copy link

For me, it was a false alarm, I had to make sure I was in the venv before I ran npm run build

In the project root, source venv/bin/activate, then npm run build worked for me.

@Mark-Abadir, I hope this helps you as well.

@Mark-Abadir
Copy link
Author

Mark-Abadir commented Jul 13, 2020

Sorry for the delayed response.

@alexcjohnson That is the entire error message. I tried using npm run build with python 2.7 and python 3.8. Same error message both times. Both have dash as part of the included packages.
ch
@RobAlonzi Thanks for the advice but I didn't get that error specifically. And source venv/bin/activate didn't change anything for me

@xhluca
Copy link

xhluca commented Aug 4, 2020

Hi Mark, here's exactly what I did wrote in the terminal (Ubuntu), and I had no error:

$ cookiecutter https://github.com/plotly/dash-component-boilerplate.git
project_name [my dash component]: 
project_shortname [my_dash_component]: 
component_name [MyDashComponent]: 
r_prefix []: 
author_name [Enter your first and last name (For package.json)]: Xing Han
author_email [Enter your email (For package.json)]: xinghan@plot.lly
github_org []: 
description [Project Description]: 
Select license:
1 - MIT License
2 - BSD License
3 - ISC License
4 - Apache Software License 2.0
5 - GNU General Public License v3
6 - Not open source
Choose from 1, 2, 3, 4, 5, 6 [1]: 
publish_on_npm [True]: 
install_dependencies [True]: 
Executing: /home/xhlu/miniconda3/bin/python -m venv venv

Installing dependencies
<...>

$ cd my_dash_components/
$ source venv/bin/activate
$ npm i
$ npm run build:all

I noticed you are running on Windows. Have you tried Windows Subsystem for Linux (WSL) 2.0? If I remember correctly, source venv/bin/activate does not work in a Win10 command prompt, so maybe you have to use venv\Scripts\activate.bat instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants