I was trying to run a command that would allow me to both build my Angular project and deploy it to firebase hosting in a one line command in VS Code's terminal using the Angular CLI.

Original Command

After running this command

ng build --prod && firebase deploy

I was met with this error message:

At line:1 char:17
+ ng build --prod && firebase deploy
+         ~~
The token '&&' is not a valid statement separator in this version.
  + CategoryInfo     : ParserError: (:) [], ParentContainsErrorRecordException
  + FullyQualifiedErrorId : InvalidEndOfLine

Solution

The solution is to use a | instead of && to separate your commands, for example:

ng build --prod | firebase deploy

I hoped this short blog post helped you fix the '&&' is not a valid statement separator error when building your Angular App using VS Code.

FeedbackI'd love to hear your feedback!
Did this blog post help fix your issue? Still having trouble?
Tweet At Me
Brendan SlukeSoftware Engineer

Hi, I'm Brendan Sluke and I love writing code and blogging about software engineering.

Follow Me On Twitter Read My Blog
Recommended Blog PostsBlog Posts I Think You Will Find Interesting
Go Back To Top of Page