Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shopify CLI frontend build (node-template) #1186

Closed
mtahirofficial opened this issue Dec 6, 2022 · 7 comments
Closed

Shopify CLI frontend build (node-template) #1186

mtahirofficial opened this issue Dec 6, 2022 · 7 comments

Comments

@mtahirofficial
Copy link

mtahirofficial commented Dec 6, 2022

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.

`SHOPIFY_API_KEY` is not recognized as an internal or external command, operable program, or batch file.

Untitled

Please, anyone, help me with this problem. I will be grateful.

@fonya2014
Copy link

fonya2014 commented Dec 6, 2022

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

@mtahirofficial
Copy link
Author

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.

@fonya2014
Copy link

I don't remember for sure, as I can see it installed for root and /web for my project

@mtahirofficial
Copy link
Author

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.

@fonya2014
Copy link

try to install it globally
npm install --global cross-env

@cquemin
Copy link
Contributor

cquemin commented Dec 19, 2022

@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.

@mkevinosullivan
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants