Skip to content Skip to sidebar Skip to footer

Package.json Complicated Start Script With "sh -ac" And .env File For Firebase

In Firefly example project in package.json there is 'start': 'sh -ac '. ./.env.dev; firebase use dev && react-scripts start'', On my Windows 10 its not working with &a

Solution 1:

sh is the POSIX command for running a shell (a shell is the program that powers the command-line terminal). Running sh -ac is saying "run the shell command and automatically export all variables assigned during its run" effectively.

A .env file is often used to describe local environment variables needed for scripts to run, so sh -ac ./.env.dev is basically saying load all the environment variables from .env.dev.

Those environment variables are then made available in the subsequent commands via && which executes multiple commands in a single context.

This script is, simply speaking, not very Windows-friendly. What you would want to do is take a look inside .env.dev at the environment variables it's setting and then set those in your local terminal before running the firebase and react-scripts commands.

Post a Comment for "Package.json Complicated Start Script With "sh -ac" And .env File For Firebase"