Shopify app template-php error Missing values for: scope

Topic summary

Issue: Running “npm run dev” for the Shopify app PHP template failed with “Cannot initialize Shopify API Library. Missing values for: scope,” despite SCOPES being set in .env (read_products,write_products).

Tried: A suggestion to run “npm run deploy” did not resolve it initially.

Resolution/Update: After executing “npm run build --api-key=REPLACE_ME” followed by “npm run deploy,” the scopes appeared on the app’s API access page, and “npm run dev” started successfully.

Notes:

  • No changes were made to .env or .toml before it began working.
  • Scopes (API permissions) may not be recognized until the app is built and deployed, even if defined in .env.

Outcome: Resolved. Practical takeaway: perform a build and deploy to propagate scopes before running the local dev server. Root cause remains unclear.

Summarized with AI on January 4. AI used: gpt-5.

I’m trying to use Shopify app PHP template from here, but it continuously fail on

npm run dev

command with this error:
Cannot initialize Shopify API Library. Missing values for: scope

Thing is that scopes are in place in .env:
SCOPES = read_products,write_products

What could be wrong here?

You might need to deploy first via

npm run deploy 

Thanks for the reply. I’ve tried that, it doesn’t work

Update: Issue is kind of resolved.
I’ve tried to build the app before, but with constant errors.
Now, after “npm run build --api-key=REPLACE_ME” and then deploy “npm run deploy” scopes appeared on the app’s API access page and “npm run dev” started successfully. Not sure where the problem was, I haven’t changed neither .env nor .toml configs.