Shopify CLI frontend build (node-template)
mtahirofficial opened this issue · 7 comments
Issue summary
I am trying to build the front end of the application developed using Shopify-CLI. I am trying to add SHOPIFY_API_KEY
as explained here.
I am trying this command cd web/frontend/ && SHOPIFY_API_KEY=REPLACE_ME npm run build
from the root directory of my project. But,
SHOPIFY_API_KEY
is not added through this command
Expected behavior
As described here the SHOPIFY_API_KEY
should be added to the build.
Actual behavior
When I run the command it's giving me an error described below and attached a screenshot of the error message.
Please, anyone, help me with this problem. I will be grateful.
Hi @mtahirofficial ! Try to install the cross-env library, and after that:
cd web/frontend/ && cross-env SHOPIFY_API_KEY=replace_me npm run build
I believe you need this: https://www.npmjs.com/package/cross-env
Hi, @fonya2014 Thanks for your reply. Can you please specify where to install cross-env?
In the project root directory, /web or /web/frontend?
I install in /web/frontend but its not working.
I don't remember for sure, as I can see it installed for root and /web for my project
I have installed it in all three places in the root, in /web, and in /web/frontend but it's not working.
It says 'cross-env' is not recognized as an internal or external command, operable program or batch file.
try to install it globally
npm install --global cross-env
@mtahirofficial I noticed that you on windows. The instructions we put there are for linux/MAC. That is a problem we should fix. Also, we should really adjust our frontend to use cross-env
as we do for our backend.
I don't have a windows machine with me to test but here is what I would recommend to try:
Install cross-env
as recommended by @fonya2014 with the following command : npm install --global cross-env
Try to enter the following commands one by one:
cd web/frontend/
cross-env SHOPIFY_API_KEY=REPLACE_ME npm run build
Hopefully this should help you.
To avoid using cross-env for building (unnecessary), the following are the correct Windows commands:
cd web\frontend
set SHOPIFY_API_KEY=REPLACE_ME
npm run build
#1250 created to track addition of Windows commands to readme file.