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.