FROM CACHE - en_header

"npm run dev" does not work.

おか
Shopify Partner
6 0 0

I am following "Build a Shopify App with Node and React". 

And I try to command "npm run dev". But this error occurs.

user@MacBook-Air poralis-chatapp % npm run dev            

> poralis-chatapp@1.0.0 dev
> node server.js

/Users/user/jumboworld/poralis-chatapp/server.js:15
  SCOPES: process.env.SHOPIFY_API_SCOPES.split(","),
                                         ^

TypeError: Cannot read property 'split' of undefined
    at Object.<anonymous> (/Users/user/jumboworld/poralis-chatapp/server.js:15:42)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:988:32)
    at Function.Module._load (node:internal/modules/cjs/loader:828:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
    at node:internal/main/run_main_module:17:47

 

Please someone helps me what I can do this error.

 

Name: Takahiro Okada
Country: Japan
Website: https://jumboworld.jp/ / https://okalog.info/
Email: info@jumboworld.jp
Replies 2 (2)
melaniew
Shopify Staff
Shopify Staff
1 0 0

Hi there! Looks like something is wrong with your .env file.

Does your file look like this?

SHOPIFY_API_KEY=[...]
SHOPIFY_API_SECRET=[...]
SHOP=shop.myshopify.com
SCOPES=write_products,write_customers,write_draft_orders
HOST=https://725e155f2b6a.ngrok.io

 

Johatz
Shopify Partner
2 0 0

Hi there Melanie, 

I am also having issues with npm run dev. Having followed all the steps in the "create your app" tutorial, when it comes to calling npm run dev, I get up to the point of the tunnel running, but then get Error - timed out. This happens all the time. I have now looked for further tutorials from last year and when following those, by using shopify app create node, shopify app serve, it does work and the app is created. However, I am also trying to follow the guidelines on the first example app, and the files of my template are completely different and I am unable to follow that when using I suppose the 'older' version of creating a first app. Do you have more documentation on the newer way, i.e. by going with npm for everything? And do you know why this error may occur when going down this route? I have tried for days now to solve this..Or what is the difference between the two options? 

Thank you! 

Screenshot 2022-08-02 at 12.27.39.png