admin管理员组文章数量:1323699
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 &&
:
Now using alias dev (firefly-boilerplate) Unknown script "start'". react-scripts start'
This script works with ;
instead of &&
, App starts, but it doesn't connect fo database:
@firebase/firestore: Firestore (5.0.4): Could not reach Cloud Firestore backend. Connection failed 2 times. Most recent error: FirebaseError: [code=not-found]: The project firefly-boilerplate
does not exist or it does not contain an active Cloud Datastore database.
So I must put Api key, domain, and project name from .env.dev
into index.js
to work. Why this script doesn't work with &&
?
What sh -ac
mand exacly do?
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 &&
:
Now using alias dev (firefly-boilerplate) Unknown script "start'". react-scripts start'
This script works with ;
instead of &&
, App starts, but it doesn't connect fo database:
@firebase/firestore: Firestore (5.0.4): Could not reach Cloud Firestore backend. Connection failed 2 times. Most recent error: FirebaseError: [code=not-found]: The project firefly-boilerplate
does not exist or it does not contain an active Cloud Datastore database.
So I must put Api key, domain, and project name from .env.dev
into index.js
to work. Why this script doesn't work with &&
?
What sh -ac
mand exacly do?
1 Answer
Reset to default 11sh
is the POSIX mand for running a shell (a shell is the program that powers the mand-line terminal). Running sh -ac
is saying "run the shell mand 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 mands via &&
which executes multiple mands 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
mands.
版权声明:本文标题:javascript - Package.json complicated start script with "sh -ac" and .env file for Firebase - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742133915a2422286.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论