I tried forking the streamlit repository successfully and managed to install everything by following the contribution instructions. However, after I finished working on the python code, I closed the frontend server and the streamlit backend. When I wanted to try to run âyarn startâ again, I constantly seem to get the following error, no matter what I try:
SyntaxError: âimportâ and âexportâ may only appear at the top level (21:4)
19 | const $root = $protobuf.roots[âdefaultâ] || ($protobuf.roots[âdefaultâ] = {});
20 |
> 21 | export const Alert = $root.Alert = (() => {
| ^
I tried to change the pbjs generation command, first switched the syntax to typescript from es6, still couldnât compile. Then I tried adding the -w commonjs flag and also tried running âyarn startâ from within the virtualenv and outside of it, but Iâm still getting the same error. This also happens to my other computer, running a linux OS.
Iâm using MacOS Catalina, but Iâm getting the same error on both machines.
I want to thank you a lot in advance for your time, as weâre actively trying to get this running for more than a day and weâre making little progress.
Itâs not clear whatâs wrong from the error message youâre seeing, but a few notes:
You shouldnât have to change the pbjs gen command. Weâre using Babel under the hood to compile frontend code to ES5.
In general, you shouldnât have to change any of the frontend code generation bits (unless youâre doing something truly exotic).
You donât need to run yarn start from within your virtualenv (it doesnât hurt anything to do so, but the virtualenv is strictly for Python land).
If compilation gets weird, oftentimes the best thing to do is to run make clean all-devel (from the streamlit root directory, within your virtualenv).
Do you have custom changes to Streamlit, or is this happening on a fresh checkout? If youâve made changes, are any of them to the build system (the makefile, or the frontendâs package.json, or anything related to that)?
Your notes totally make sense, as I was pointlessly trying stuff out in order to make this thing compile.
What I did is just recloned the repo where I had already pushed my altered code, followed the contribution guidelines and somehow it managed to work. I probably corrupted some files in the previous repo.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking âAccept allâ, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.