Can't run "yarn start"

Dear community,

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.

Best regards

Hi @Ivan_Pokupec, welcome to Streamlit!

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)?


Hi @tim, thanks for the warm welcome!

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 a lot for the help :slight_smile:


As i faced the exact same problem i was wondering if it was related to the make sequence. i never ran make all-devel but instead ran:

make mini-devel
make init
make install
make develop

as i was wondering if i missed something since it didnt work.

Anyways, thanks alot for the hint, now we can build and hopefully contribute!


Glad to hear it, and looking forward to seeing what you guys build!

1 Like