Cannot read properties of undefined (reading 'code')

Hello there! I’m completely new to hydrogen; have made some progess getting the mock.shop running and using h2 login to auth with my store. However, commands like h2 env pull etc. trigger the following error:

h2 env pull
╭─ error ──────────────────────────────────────────────────────────────────────╮
│                                                                              │
│  Cannot read properties of undefined (reading 'code')                        │
│                                                                              │
│  To investigate the issue, examine this stack trace:                         │
│    at (home/daryl/repos/shoppyshop/node_modules/.pnpm/@shopify+cli@3.69.4/n  │
│    ode_modules/@shopify/cli/dist/chunk-7NPDPZ22.js:29909)                    │
│    at some                                                                   │
│    at makeVerboseRequest                                                     │
│    (home/daryl/repos/shoppyshop/node_modules/.pnpm/@shopify+cli@3.69.4/node  │
│    _modules/@shopify/cli/dist/chunk-7NPDPZ22.js:29909)                       │
│    at processTicksAndRejections (node:internal/process/task_queues:95)       │
│    at async retryAwareRequest                                                │
│    (home/daryl/repos/shoppyshop/node_modules/.pnpm/@shopify+cli@3.69.4/node  │
│    _modules/@shopify/cli/dist/chunk-7NPDPZ22.js:29972)                       │
│    at (home/daryl/repos/shoppyshop/node_modules/.pnpm/@shopify+cli@3.69.4/n  │
│    ode_modules/@shopify/cli/dist/chunk-7NPDPZ22.js:31486)                    │
│    at (home/daryl/repos/shoppyshop/node_modules/.pnpm/@shopify+cli@3.69.4/n  │
│    ode_modules/@shopify/cli/dist/chunk-2NCWYVM4.js:29948)                    │
│    at async adminRequest                                                     │
│    (home/daryl/repos/shoppyshop/node_modules/.pnpm/@shopify+cli@3.69.4/node  │
│    _modules/@shopify/cli/dist/chunk-BRO6DC7D.js:141329)                      │
│    at async getStorefronts                                                   │
│    (home/daryl/repos/shoppyshop/node_modules/.pnpm/@shopify+cli@3.69.4/node  │
│    _modules/@shopify/cli/dist/chunk-BRO6DC7D.js:141381)                      │
│    at async verifyLinkedStorefront                                           │
│    (home/daryl/repos/shoppyshop/node_modules/.pnpm/@shopify+cli@3.69.4/node  │
│    _modules/@shopify/cli/dist/index.js:154452)                               │
│                                                         

and h2 list

 h2 list
╭─ error ──────────────────────────────────────────────────────────────────────╮
│                                                                              │
│  Cannot read properties of undefined (reading 'code')                        │
│                                                                              │
│  To investigate the issue, examine this stack trace:                         │
│    at (home/daryl/repos/shoppyshop/node_modules/.pnpm/@shopify+cli@3.69.4/n  │
│    ode_modules/@shopify/cli/dist/chunk-7NPDPZ22.js:29909)                    │
│    at some                                                                   │
│    at makeVerboseRequest                                                     │
│    (home/daryl/repos/shoppyshop/node_modules/.pnpm/@shopify+cli@3.69.4/node  │
│    _modules/@shopify/cli/dist/chunk-7NPDPZ22.js:29909)                       │
│    at processTicksAndRejections (node:internal/process/task_queues:95)       │
│    at async retryAwareRequest                                                │
│    (home/daryl/repos/shoppyshop/node_modules/.pnpm/@shopify+cli@3.69.4/node  │
│    _modules/@shopify/cli/dist/chunk-7NPDPZ22.js:29972)                       │
│    at (home/daryl/repos/shoppyshop/node_modules/.pnpm/@shopify+cli@3.69.4/n  │
│    ode_modules/@shopify/cli/dist/chunk-7NPDPZ22.js:31486)                    │
│    at (home/daryl/repos/shoppyshop/node_modules/.pnpm/@shopify+cli@3.69.4/n  │
│    ode_modules/@shopify/cli/dist/chunk-2NCWYVM4.js:29948)                    │
│    at async adminRequest                                                     │
│    (home/daryl/repos/shoppyshop/node_modules/.pnpm/@shopify+cli@3.69.4/node  │
│    _modules/@shopify/cli/dist/chunk-BRO6DC7D.js:141329)                      │
│    at async getStorefrontsWithDeployment                                     │
│    (home/daryl/repos/shoppyshop/node_modules/.pnpm/@shopify+cli@3.69.4/node  │
│    _modules/@shopify/cli/dist/index.js:157435)                               │
│    at async runList (home/daryl/repos/shoppyshop/node_modules/.pnpm/@shopif  │
│    y+cli@3.69.4/node_modules/@shopify/cli/dist/index.js:157458)          

I’m using:

shopify --version
@shopify/cli/3.69.4 wsl-x64 node-v18.20.4

I’m struggling to make progress. I’ve tried reinstalling latest of everything with pnpm and am still getting the following:

pnpm create @shopify/hydrogen@latest
?  Connect to Shopify:
✔  Link your Shopify account

?  Select a shop to log in to:
✔  Local Aussie Living (mzejgb-ur.myshopify.com)

╭─ success ──────────────────────────────────────────────────────────────────────╮
│                                                                                │
│  Shopify authentication complete                                               │
│                                                                                │
│  You are logged in to Local Aussie Living as daryl@aussie.store                │
│                                                                                │
╰────────────────────────────────────────────────────────────────────────────────╯

file:///home/daryl/.cache/pnpm/dlx/exuzlubrtdzocm7tl3vwyn7jdm/192f784b74c-11783/node_modules/.pnpm/@shopify+create-hydrogen@5.0.11/node_modules/@shopify/create-hydrogen/dist/chunk-VXN7NK7B.js:1511
`)))!==null&&r!==void 0?r:!1}N();var hBt=n=>{let r,i=n.definitions.filter(o=>o.kind==="OperationDefinition");return i.length===1&&(r=i[0]?.name?.value),r},aB=n=>{if(typeof n=="string"){let i;try{let o=F4e(n);i=hBt(o)}catch{}return{query:n,operationName:i}}let r=hBt(n);return{query:L4e(n),operationName:r}};N();var D9=class n extends Error{constructor(r,i){let o=`${n.extractMessage(r)}: ${JSON.stringify({response:r,request:i})}`;super(o),Object.setPrototypeOf(this,n.prototype),this.response=r,this.request=i,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,n)}static extractMessage(r){return r.errors?.[0]?.message??`GraphQL Error (Code: ${r.status})`}};var fB=Ya(rUt(),1);N();var lsn="connection_init",usn="connection_ack",iUt="ping",aUt="pong",psn="subscribe",fsn="next",dsn="error",sUt="complete",pB=class n{get type(){return this._type}get id(){return this._id}get payload(){return this._payload}constructor(r,i,o){this._type=r,this._payload=i,this._id=o}get text(){let r={type:this.type};return this.id!=null&&this.id!=null&&(r.id=this.id),this.payload!=null&&this.payload!=null&&(r.payload=this.payload),JSON.stringify(r)}static parse(r,i){let{type:o,payload:u,id:d}=JSON.parse(r);return new n(o,i(u),d)}},$4e=class{constructor(r,{onInit:i,onAcknowledged:o,onPing:u,onPong:d}){this.socketState={acknowledged:!1,lastRequestId:0,subscriptions:{}},this.socket=r,r.onopen=async h=>{this.socketState.acknowledged=!1,this.socketState.subscriptions={},r.send(msn(i?await i():null).text)},r.onclose=h=>{this.socketState.acknowledged=!1,this.socketState.subscriptions={}},r.onerror=h=>{console.error(h)},r.onmessage=h=>{try{let x=_sn(h.data);switch(x.type){case usn:{this.socketState.acknowledged?console.warn("Duplicate CONNECTION_ACK message ignored"):(this.socketState.acknowledged=!0,o&&o(x.payload));return}case iUt:{u?u(x.payload).then(W=>r.send(nUt(W).text)):r.send(nUt(null).text);return}case aUt:{d&&d(x.payload);return}}if(!this.socketState.acknowledged||x.id===void 0||x.id===null||!this.socketState.subscriptions[x.id])return;let{query:w,variables:P,subscriber:j}=this.socketState.subscriptions[x.id];switch(x.type){case fsn:{!x.payload.errors&&x.payload.data&&j.next&&j.next(x.payload.data),x.payload.errors&&j.error&&j.error(new D9({...x.payload,status:200},{query:w,variables:P}));return}case dsn:{j.error&&j.error(new D9({errors:x.payload,status:200},{query:w,variables:P}));return}case sUt:{j.complete&&j.complete(),delete this.socketState.subscriptions[x.id];return}}}catch(x){console.error(x),r.close(1006)}r.close(4400,"Unknown graphql-ws message.")}}makeSubscribe(r,i,o,u){let d=(this.socketState.lastRequestId++).toString();return this.socketState.subscriptions[d]={query:r,variables:u,subscriber:o},this.socket.send(gsn(d,{query:r,operationName:i,variables:u}).text),()=>{this.socket.send(ysn(d).text),delete this.socketState.subscriptions[d]}}rawRequest(r,i){return new Promise((o,u)=>{let d;this.rawSubscribe(r,{next:(h,x)=>d={data:h,extensions:x},error:u,complete:()=>o(d)},i)})}request(r,i){return new Promise((o,u)=>{let d;this.subscribe(r,{next:h=>d=h,error:u,complete:()=>o(d)},i)})}subscribe(r,i,o){let{query:u,operationName:d}=aB(r);return this.makeSubscribe(u,d,i,o)}rawSubscribe(r,i,o){return this.makeSubscribe(r,void 0,i,o)}ping(r){this.socket.send(hsn(r).text)}close(){this.socket.close(1e3)}};$4e.PROTOCOL="graphql-transport-ws";function _sn(n,r=i=>i){return pB.parse(n,r)}function msn(n){return new pB(lsn,n)}function hsn(n){return new pB(iUt,n,void 0)}function nUt(n){return new pB(aUt,n,void 0)}function gsn(n,r){return new pB(psn,r,n)}function ysn(n){return new pB(sUt,void 0,n)}var cZ=n=>{let r={};return n&&(typeof Headers<"u"&&n instanceof Headers||fB&&fB.Headers&&n instanceof fB.Headers?r=Hjt(n):Array.isArray(n)?n.forEach(([i,o])=>{i&&o!==void 0&&(r[i]=o)}):r=n),r},oUt=n=>n.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),vsn=n=>{if(!Array.isArray(n.query)){let o=n,u=[`query=${encodeURIComponent(oUt(o.query))}`];return n.variables&&u.push(`variables=${encodeURIComponent(o.jsonSerializer.stringify(o.variables))}`),o.operationName&&u.push(`operationName=${encodeURIComponent(o.operationName)}`),u.join("&")}if(typeof n.variables<"u"&&!Array.isArray(n.variables))throw new Error("Cannot create query with given variable type, array expected");let r=n,i=n.query.reduce((o,u,d)=>(o.push({query:oUt(u),variables:r.variables?r.jsonSerializer.stringify(r.variables[d]):void 0}),o),[]);return`query=${encodeURIComponent(r.jsonSerializer.stringify(i))}`},bsn=n=>async r=>{let{url:i,query:o,variables:u,operationName:d,fetch:h,fetchOptions:x,middleware:w}=r,P={...r.headers},j="",W;n==="POST"?(W=Jjt(o,u,d,x.jsonSerializer),typeof W=="string"&&(P["Content-Type"]="application/json")):j=vsn({query:o,variables:u,operationName:d,jsonSerializer:x.jsonSerializer??pue});let U={method:n,headers:P,body:W,...x},H=i,ee=U;if(w){let K=await Promise.resolve(w({...U,url:i,operationName:d,variables:u})),{url:ne,...Me}=K;H=ne,ee=Me}return j&&(H=`${H}?${j}`),await h(H,ee)},V4e=class{constructor(r,i={}){this.url=r,this.requestConfig=i,this.rawRequest=async(...o)=>{let[u,d,h]=o,x=Xjt(u,d,h),{headers:w,fetch:P=fB.default,method:j="POST",requestMiddleware:W,responseMiddleware:U,...H}=this.requestConfig,{url:ee}=this;x.signal!==void 0&&(H.signal=x.signal);let{operationName:K}=aB(x.query);return PJe({url:ee,query:x.query,variables:x.variables,headers:{...cZ(IJe(w)),...cZ(x.requestHeaders)},operationName:K,fetch:P,method:j,fetchOptions:H,middleware:W}).then(ne=>(U&&U(ne),ne)).catch(ne=>{throw U&&U(ne),ne})}}async request(r,...i){let[o,u]=i,d=Gjt(r,o,u),{headers:h,fetch:x=fB.default,method:w="POST",requestMiddleware:P,responseMiddleware:j,...W}=this.requestConfig,{url:U}=this;d.signal!==void 0&&(W.signal=d.signal);let{query:H,operationName:ee}=aB(d.document);return PJe({url:U,query:H,variables:d.variables,headers:{...cZ(IJe(h)),...cZ(d.requestHeaders)},operationName:ee,fetch:x,method:w,fetchOptions:W,middleware:P}).then(K=>(j&&j(K),K.data)).catch(K=>{throw j&&j(K),K})}batchRequests(r,i){let o=Kjt(r,i),{headers:u,...d}=this.requestConfig;o.signal!==void 0&&(d.signal=o.signal);let h=o.documents.map(({document:w})=>aB(w).query),x=o.documents.map(({variables:w})=>w);return PJe({url:this.url,query:h,variables:x,headers:{...cZ(IJe(u)),...cZ(o.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??fB.default,method:this.requestConfig.method||"POST",fetchOptions:d,middleware:this.requestConfig.requestMiddleware}).then(w=>(this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(w),w.data)).catch(w=>{throw this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(w),w})}setHeaders(r){return this.requestConfig.headers=r,this}setHeader(r,i){let{headers:o}=this.requestConfig;return o?o[r]=i:this.requestConfig.headers={[r]:i},this}setEndpoint(r){return this.url=r,this}},PJe=async n=>{let{query:r,variables:i,fetchOptions:o}=n,u=bsn(Wjt(n.method??"post")),d=Array.isArray(n.query),h=await u(n),x=await xsn(h,o.jsonSerializer??pue),w=Array.isArray(x)?!x.some(({data:j})=>!j):!!x.data,P=Array.isArray(x)||!x.errors||Array.isArray(x.errors)&&!x.errors.length||o.errorPolicy==="all"||o.errorPolicy==="ignore";if(h.ok&&P&&w){let{errors:j,...W}=(Array.isArray(x),x),U=o.errorPolicy==="ignore"?W:x;return{...d?{data:U}:U,headers:h.headers,status:h.status}}else{let j=typeof x=="string"?{error:x}:x;throw new D9({...j,status:h.status,headers:h.headers},{query:r,variables:i})}};var xsn=async(n,r)=>{let i;return n.headers.forEach((o,u)=>{u.toLowerCase()==="content-type"&&(i=o)}),i&&(i.toLowerCase().startsWith("application/json")||i.toLowerCase().startsWith("application/graphql+json")||i.toLowerCase().startsWith("application/graphql-response+json"))?r.parse(await n.text()):n.text()},IJe=n=>typeof n=="function"?n():n,cUt=(n,...r)=>n.reduce((i,o,u)=>`${i}${o}${u in r?r[u]:""}`,"");import{performance as OJe}from"perf_hooks";var uUt=["admin","storefront-renderer","partners","business-platform","app-management"],Ssn=1e3,Esn=10,Tsn=new Set(["cache-control","content-type","etag","x-request-id","server-timing","retry-after"]);function lUt(n){return Tsn.has(n)}async function FJe({request:n,url:r}){let i=OJe.now(),o=0,u={},d=D4e(r),h={};try{h=await n(),h.headers.forEach((w,P)=>{lUt(P)&&(u[P]=w)})}catch(w){let P=OJe.now();if(o=Math.round(P-i),w instanceof D9){if(w.response.headers)for(let[W,U]of w.response.headers)lUt(W)&&(u[W]=U);let j=nB(u);if(w.response.errors?.some(W=>W.extensions.code==="429")||w.response.status===429){let W;try{W=u["retry-after"]?Number.parseInt(u["retry-after"],10):void 0}catch{}return{status:"can-retry",clientError:w,duration:o,sanitizedHeaders:j,sanitizedUrl:d,requestId:u["x-request-id"],delayMs:W}}return{status:"client-error",clientError:w,duration:o,sanitizedHeaders:j,sanitizedUrl:d,requestId:u["x-request-id"]}}return{status:"unknown-error",error:w,duration:o,sanitizedHeaders:nB(u),sanitizedUrl:d,requestId:u["x-request-id"]}}let x=OJe.now();return o=Math.round(x-i),{status:"ok",response:h,duration:o,sanitizedHeaders:nB(u),sanitizedUrl:d,requestId:u["x-request-id"]}}async function RJe({request:n,url:r},i){let o=await FJe({request:n,url:r});switch(nc(`Request to ${o.sanitizedUrl} completed in ${o.duration} ms
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

TypeError: Cannot read properties of undefined (reading 'code')
    at file:///home/daryl/.cache/pnpm/dlx/exuzlubrtdzocm7tl3vwyn7jdm/192f784b74c-11783/node_modules/.pnpm/@shopify+create-hydrogen@5.0.11/node_modules/@shopify/create-hydrogen/dist/chunk-VXN7NK7B.js:1511:8502
    at Array.some (<anonymous>)
    at FJe (file:///home/daryl/.cache/pnpm/dlx/exuzlubrtdzocm7tl3vwyn7jdm/192f784b74c-11783/node_modules/.pnpm/@shopify+create-hydrogen@5.0.11/node_modules/@shopify/create-hydrogen/dist/chunk-VXN7NK7B.js:1511:8481)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async pUt (file:///home/daryl/.cache/pnpm/dlx/exuzlubrtdzocm7tl3vwyn7jdm/192f784b74c-11783/node_modules/.pnpm/@shopify+create-hydrogen@5.0.11/node_modules/@shopify/create-hydrogen/dist/chunk-VXN7NK7B.js:1514:345)
    at async file:///home/daryl/.cache/pnpm/dlx/exuzlubrtdzocm7tl3vwyn7jdm/192f784b74c-11783/node_modules/.pnpm/@shopify+create-hydrogen@5.0.11/node_modules/@shopify/create-hydrogen/dist/chunk-VXN7NK7B.js:1548:349
    at async file:///home/daryl/.cache/pnpm/dlx/exuzlubrtdzocm7tl3vwyn7jdm/192f784b74c-11783/node_modules/.pnpm/@shopify+create-hydrogen@5.0.11/node_modules/@shopify/create-hydrogen/dist/chunk-VXN7NK7B.js:1406:7194
    at async u8 (file:///home/daryl/.cache/pnpm/dlx/exuzlubrtdzocm7tl3vwyn7jdm/192f784b74c-11783/node_modules/.pnpm/@shopify+create-hydrogen@5.0.11/node_modules/@shopify/create-hydrogen/dist/create-app.js:1177:6742)
    at async xve (file:///home/daryl/.cache/pnpm/dlx/exuzlubrtdzocm7tl3vwyn7jdm/192f784b74c-11783/node_modules/.pnpm/@shopify+create-hydrogen@5.0.11/node_modules/@shopify/create-hydrogen/dist/create-app.js:1185:52)
    at async Ave (file:///home/daryl/.cache/pnpm/dlx/exuzlubrtdzocm7tl3vwyn7jdm/192f784b74c-11783/node_modules/.pnpm/@shopify+create-hydrogen@5.0.11/node_modules/@shopify/create-hydrogen/dist/create-app.js:1185:1430)

Node.js v20.18.0

Tried with npm

npm create @shopify/hydrogen
Need to install the following packages:
@shopify/create-hydrogen@5.0.11
Ok to proceed? (y) y


> npx
> create-hydrogen

?  Connect to Shopify:
✔  Link your Shopify account

?  Select a shop to log in to:
✔  Local Aussie Living (mzejgb-ur.myshopify.com)

╭─ success ──────────────────────────────────────────────────────────────────────╮
│                                                                                │
│  Shopify authentication complete                                               │
│                                                                                │
│  You are logged in to Local Aussie Living as daryl@aussie.store                │
│                                                                                │
╰────────────────────────────────────────────────────────────────────────────────╯

file:///home/daryl/.npm/_npx/c78eec8d27f8df64/node_modules/@shopify/create-hydrogen/dist/chunk-VXN7NK7B.js:1511
`)))!==null&&r!==void 0?r:!1}N();var hBt=n=>{let r,i=n.definitions.filter(o=>o.kind==="OperationDefinition");return i.length===1&&(r=i[0]?.name?.value),r},aB=n=>{if(typeof n=="string"){let i;try{let o=F4e(n);i=hBt(o)}catch{}return{query:n,operationName:i}}let r=hBt(n);return{query:L4e(n),operationName:r}};N();var D9=class n extends Error{constructor(r,i){let o=`${n.extractMessage(r)}: ${JSON.stringify({response:r,request:i})}`;super(o),Object.setPrototypeOf(this,n.prototype),this.response=r,this.request=i,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,n)}static extractMessage(r){return r.errors?.[0]?.message??`GraphQL Error (Code: ${r.status})`}};var fB=Ya(rUt(),1);N();var lsn="connection_init",usn="connection_ack",iUt="ping",aUt="pong",psn="subscribe",fsn="next",dsn="error",sUt="complete",pB=class n{get type(){return this._type}get id(){return this._id}get payload(){return this._payload}constructor(r,i,o){this._type=r,this._payload=i,this._id=o}get text(){let r={type:this.type};return this.id!=null&&this.id!=null&&(r.id=this.id),this.payload!=null&&this.payload!=null&&(r.payload=this.payload),JSON.stringify(r)}static parse(r,i){let{type:o,payload:u,id:d}=JSON.parse(r);return new n(o,i(u),d)}},$4e=class{constructor(r,{onInit:i,onAcknowledged:o,onPing:u,onPong:d}){this.socketState={acknowledged:!1,lastRequestId:0,subscriptions:{}},this.socket=r,r.onopen=async h=>{this.socketState.acknowledged=!1,this.socketState.subscriptions={},r.send(msn(i?await i():null).text)},r.onclose=h=>{this.socketState.acknowledged=!1,this.socketState.subscriptions={}},r.onerror=h=>{console.error(h)},r.onmessage=h=>{try{let x=_sn(h.data);switch(x.type){case usn:{this.socketState.acknowledged?console.warn("Duplicate CONNECTION_ACK message ignored"):(this.socketState.acknowledged=!0,o&&o(x.payload));return}case iUt:{u?u(x.payload).then(W=>r.send(nUt(W).text)):r.send(nUt(null).text);return}case aUt:{d&&d(x.payload);return}}if(!this.socketState.acknowledged||x.id===void 0||x.id===null||!this.socketState.subscriptions[x.id])return;let{query:w,variables:P,subscriber:j}=this.socketState.subscriptions[x.id];switch(x.type){case fsn:{!x.payload.errors&&x.payload.data&&j.next&&j.next(x.payload.data),x.payload.errors&&j.error&&j.error(new D9({...x.payload,status:200},{query:w,variables:P}));return}case dsn:{j.error&&j.error(new D9({errors:x.payload,status:200},{query:w,variables:P}));return}case sUt:{j.complete&&j.complete(),delete this.socketState.subscriptions[x.id];return}}}catch(x){console.error(x),r.close(1006)}r.close(4400,"Unknown graphql-ws message.")}}makeSubscribe(r,i,o,u){let d=(this.socketState.lastRequestId++).toString();return this.socketState.subscriptions[d]={query:r,variables:u,subscriber:o},this.socket.send(gsn(d,{query:r,operationName:i,variables:u}).text),()=>{this.socket.send(ysn(d).text),delete this.socketState.subscriptions[d]}}rawRequest(r,i){return new Promise((o,u)=>{let d;this.rawSubscribe(r,{next:(h,x)=>d={data:h,extensions:x},error:u,complete:()=>o(d)},i)})}request(r,i){return new Promise((o,u)=>{let d;this.subscribe(r,{next:h=>d=h,error:u,complete:()=>o(d)},i)})}subscribe(r,i,o){let{query:u,operationName:d}=aB(r);return this.makeSubscribe(u,d,i,o)}rawSubscribe(r,i,o){return this.makeSubscribe(r,void 0,i,o)}ping(r){this.socket.send(hsn(r).text)}close(){this.socket.close(1e3)}};$4e.PROTOCOL="graphql-transport-ws";function _sn(n,r=i=>i){return pB.parse(n,r)}function msn(n){return new pB(lsn,n)}function hsn(n){return new pB(iUt,n,void 0)}function nUt(n){return new pB(aUt,n,void 0)}function gsn(n,r){return new pB(psn,r,n)}function ysn(n){return new pB(sUt,void 0,n)}var cZ=n=>{let r={};return n&&(typeof Headers<"u"&&n instanceof Headers||fB&&fB.Headers&&n instanceof fB.Headers?r=Hjt(n):Array.isArray(n)?n.forEach(([i,o])=>{i&&o!==void 0&&(r[i]=o)}):r=n),r},oUt=n=>n.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),vsn=n=>{if(!Array.isArray(n.query)){let o=n,u=[`query=${encodeURIComponent(oUt(o.query))}`];return n.variables&&u.push(`variables=${encodeURIComponent(o.jsonSerializer.stringify(o.variables))}`),o.operationName&&u.push(`operationName=${encodeURIComponent(o.operationName)}`),u.join("&")}if(typeof n.variables<"u"&&!Array.isArray(n.variables))throw new Error("Cannot create query with given variable type, array expected");let r=n,i=n.query.reduce((o,u,d)=>(o.push({query:oUt(u),variables:r.variables?r.jsonSerializer.stringify(r.variables[d]):void 0}),o),[]);return`query=${encodeURIComponent(r.jsonSerializer.stringify(i))}`},bsn=n=>async r=>{let{url:i,query:o,variables:u,operationName:d,fetch:h,fetchOptions:x,middleware:w}=r,P={...r.headers},j="",W;n==="POST"?(W=Jjt(o,u,d,x.jsonSerializer),typeof W=="string"&&(P["Content-Type"]="application/json")):j=vsn({query:o,variables:u,operationName:d,jsonSerializer:x.jsonSerializer??pue});let U={method:n,headers:P,body:W,...x},H=i,ee=U;if(w){let K=await Promise.resolve(w({...U,url:i,operationName:d,variables:u})),{url:ne,...Me}=K;H=ne,ee=Me}return j&&(H=`${H}?${j}`),await h(H,ee)},V4e=class{constructor(r,i={}){this.url=r,this.requestConfig=i,this.rawRequest=async(...o)=>{let[u,d,h]=o,x=Xjt(u,d,h),{headers:w,fetch:P=fB.default,method:j="POST",requestMiddleware:W,responseMiddleware:U,...H}=this.requestConfig,{url:ee}=this;x.signal!==void 0&&(H.signal=x.signal);let{operationName:K}=aB(x.query);return PJe({url:ee,query:x.query,variables:x.variables,headers:{...cZ(IJe(w)),...cZ(x.requestHeaders)},operationName:K,fetch:P,method:j,fetchOptions:H,middleware:W}).then(ne=>(U&&U(ne),ne)).catch(ne=>{throw U&&U(ne),ne})}}async request(r,...i){let[o,u]=i,d=Gjt(r,o,u),{headers:h,fetch:x=fB.default,method:w="POST",requestMiddleware:P,responseMiddleware:j,...W}=this.requestConfig,{url:U}=this;d.signal!==void 0&&(W.signal=d.signal);let{query:H,operationName:ee}=aB(d.document);return PJe({url:U,query:H,variables:d.variables,headers:{...cZ(IJe(h)),...cZ(d.requestHeaders)},operationName:ee,fetch:x,method:w,fetchOptions:W,middleware:P}).then(K=>(j&&j(K),K.data)).catch(K=>{throw j&&j(K),K})}batchRequests(r,i){let o=Kjt(r,i),{headers:u,...d}=this.requestConfig;o.signal!==void 0&&(d.signal=o.signal);let h=o.documents.map(({document:w})=>aB(w).query),x=o.documents.map(({variables:w})=>w);return PJe({url:this.url,query:h,variables:x,headers:{...cZ(IJe(u)),...cZ(o.requestHeaders)},operationName:void 0,fetch:this.requestConfig.fetch??fB.default,method:this.requestConfig.method||"POST",fetchOptions:d,middleware:this.requestConfig.requestMiddleware}).then(w=>(this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(w),w.data)).catch(w=>{throw this.requestConfig.responseMiddleware&&this.requestConfig.responseMiddleware(w),w})}setHeaders(r){return this.requestConfig.headers=r,this}setHeader(r,i){let{headers:o}=this.requestConfig;return o?o[r]=i:this.requestConfig.headers={[r]:i},this}setEndpoint(r){return this.url=r,this}},PJe=async n=>{let{query:r,variables:i,fetchOptions:o}=n,u=bsn(Wjt(n.method??"post")),d=Array.isArray(n.query),h=await u(n),x=await xsn(h,o.jsonSerializer??pue),w=Array.isArray(x)?!x.some(({data:j})=>!j):!!x.data,P=Array.isArray(x)||!x.errors||Array.isArray(x.errors)&&!x.errors.length||o.errorPolicy==="all"||o.errorPolicy==="ignore";if(h.ok&&P&&w){let{errors:j,...W}=(Array.isArray(x),x),U=o.errorPolicy==="ignore"?W:x;return{...d?{data:U}:U,headers:h.headers,status:h.status}}else{let j=typeof x=="string"?{error:x}:x;throw new D9({...j,status:h.status,headers:h.headers},{query:r,variables:i})}};var xsn=async(n,r)=>{let i;return n.headers.forEach((o,u)=>{u.toLowerCase()==="content-type"&&(i=o)}),i&&(i.toLowerCase().startsWith("application/json")||i.toLowerCase().startsWith("application/graphql+json")||i.toLowerCase().startsWith("application/graphql-response+json"))?r.parse(await n.text()):n.text()},IJe=n=>typeof n=="function"?n():n,cUt=(n,...r)=>n.reduce((i,o,u)=>`${i}${o}${u in r?r[u]:""}`,"");import{performance as OJe}from"perf_hooks";var uUt=["admin","storefront-renderer","partners","business-platform","app-management"],Ssn=1e3,Esn=10,Tsn=new Set(["cache-control","content-type","etag","x-request-id","server-timing","retry-after"]);function lUt(n){return Tsn.has(n)}async function FJe({request:n,url:r}){let i=OJe.now(),o=0,u={},d=D4e(r),h={};try{h=await n(),h.headers.forEach((w,P)=>{lUt(P)&&(u[P]=w)})}catch(w){let P=OJe.now();if(o=Math.round(P-i),w instanceof D9){if(w.response.headers)for(let[W,U]of w.response.headers)lUt(W)&&(u[W]=U);let j=nB(u);if(w.response.errors?.some(W=>W.extensions.code==="429")||w.response.status===429){let W;try{W=u["retry-after"]?Number.parseInt(u["retry-after"],10):void 0}catch{}return{status:"can-retry",clientError:w,duration:o,sanitizedHeaders:j,sanitizedUrl:d,requestId:u["x-request-id"],delayMs:W}}return{status:"client-error",clientError:w,duration:o,sanitizedHeaders:j,sanitizedUrl:d,requestId:u["x-request-id"]}}return{status:"unknown-error",error:w,duration:o,sanitizedHeaders:nB(u),sanitizedUrl:d,requestId:u["x-request-id"]}}let x=OJe.now();return o=Math.round(x-i),{status:"ok",response:h,duration:o,sanitizedHeaders:nB(u),sanitizedUrl:d,requestId:u["x-request-id"]}}async function RJe({request:n,url:r},i){let o=await FJe({request:n,url:r});switch(nc(`Request to ${o.sanitizedUrl} completed in ${o.duration} ms
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

TypeError: Cannot read properties of undefined (reading 'code')
    at file:///home/daryl/.npm/_npx/c78eec8d27f8df64/node_modules/@shopify/create-hydrogen/dist/chunk-VXN7NK7B.js:1511:8502
    at Array.some (<anonymous>)
    at FJe (file:///home/daryl/.npm/_npx/c78eec8d27f8df64/node_modules/@shopify/create-hydrogen/dist/chunk-VXN7NK7B.js:1511:8481)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async pUt (file:///home/daryl/.npm/_npx/c78eec8d27f8df64/node_modules/@shopify/create-hydrogen/dist/chunk-VXN7NK7B.js:1514:345)
    at async file:///home/daryl/.npm/_npx/c78eec8d27f8df64/node_modules/@shopify/create-hydrogen/dist/chunk-VXN7NK7B.js:1548:349
    at async file:///home/daryl/.npm/_npx/c78eec8d27f8df64/node_modules/@shopify/create-hydrogen/dist/chunk-VXN7NK7B.js:1406:7194
    at async u8 (file:///home/daryl/.npm/_npx/c78eec8d27f8df64/node_modules/@shopify/create-hydrogen/dist/create-app.js:1177:6742)
    at async xve (file:///home/daryl/.npm/_npx/c78eec8d27f8df64/node_modules/@shopify/create-hydrogen/dist/create-app.js:1185:52)
    at async Ave (file:///home/daryl/.npm/_npx/c78eec8d27f8df64/node_modules/@shopify/create-hydrogen/dist/create-app.js:1185:1430)

Node.js v20.18.0
npm error code 1
npm error path /home/daryl/repos
npm error command failed
npm error command sh -c create-hydrogen
npm error A complete log of this run can be found in: /home/daryl/.npm/_logs/2024-11-05T02_49_31_754Z-debug-0.log

The contents of the logs:

0 verbose cli /home/daryl/.nvm/versions/node/v20.18.0/bin/node /home/daryl/.nvm/versions/node/v20.18.0/bin/npm
1 info using npm@10.8.2
2 info using node@v20.18.0
3 silly config load:file:/home/daryl/.nvm/versions/node/v20.18.0/lib/node_modules/npm/npmrc
4 silly config load:file:/home/daryl/repos/.npmrc
5 silly config load:file:/home/daryl/.npmrc
6 silly config load:file:/home/daryl/.nvm/versions/node/v20.18.0/etc/npmrc
7 verbose title npm create @shopify/hydrogen
8 verbose argv "create" "@shopify/hydrogen"
9 verbose logfile logs-max:10 dir:/home/daryl/.npm/_logs/2024-11-05T02_49_31_754Z-
10 verbose logfile /home/daryl/.npm/_logs/2024-11-05T02_49_31_754Z-debug-0.log
11 silly logfile start cleaning logs, removing 7 files
12 silly packumentCache heap:2197815296 maxSize:549453824 maxEntrySize:274726912
13 silly logfile done cleaning log files
14 http fetch GET 200 https://registry.npmjs.org/@shopify%2fcreate-hydrogen 492ms (cache miss)
15 silly packumentCache heap:2197815296 maxSize:549453824 maxEntrySize:274726912
16 silly idealTree buildDeps
17 silly fetch manifest @shopify/create-hydrogen@5.0.11
18 silly packumentCache full:https://registry.npmjs.org/@shopify%2fcreate-hydrogen cache-miss
19 http fetch GET 200 https://registry.npmjs.org/@shopify%2fcreate-hydrogen 1545ms (cache miss)
20 silly packumentCache full:https://registry.npmjs.org/@shopify%2fcreate-hydrogen set size:undefined disposed:false
21 silly placeDep ROOT @shopify/create-hydrogen@5.0.11 OK for:  want: 5.0.11
22 silly fetch manifest @ast-grep/napi@0.11.0
23 silly packumentCache full:https://registry.npmjs.org/@ast-grep%2fnapi cache-miss
24 http fetch GET 200 https://registry.npmjs.org/@ast-grep%2fnapi 1748ms (cache revalidated)
25 silly packumentCache full:https://registry.npmjs.org/@ast-grep%2fnapi set size:346432 disposed:false
26 silly placeDep ROOT @ast-grep/napi@0.11.0 OK for: @shopify/create-hydrogen@5.0.11 want: 0.11.0
27 silly fetch manifest @ast-grep/napi-darwin-x64@0.11.0
28 silly packumentCache full:https://registry.npmjs.org/@ast-grep%2fnapi-darwin-x64 cache-miss
29 silly fetch manifest @ast-grep/napi-darwin-arm64@0.11.0
30 silly packumentCache full:https://registry.npmjs.org/@ast-grep%2fnapi-darwin-arm64 cache-miss
31 silly fetch manifest @ast-grep/napi-linux-x64-gnu@0.11.0
32 silly packumentCache full:https://registry.npmjs.org/@ast-grep%2fnapi-linux-x64-gnu cache-miss
33 silly fetch manifest @ast-grep/napi-win32-x64-msvc@0.11.0
34 silly packumentCache full:https://registry.npmjs.org/@ast-grep%2fnapi-win32-x64-msvc cache-miss
35 silly fetch manifest @ast-grep/napi-win32-ia32-msvc@0.11.0
36 silly packumentCache full:https://registry.npmjs.org/@ast-grep%2fnapi-win32-ia32-msvc cache-miss
37 silly fetch manifest @ast-grep/napi-win32-arm64-msvc@0.11.0
38 silly packumentCache full:https://registry.npmjs.org/@ast-grep%2fnapi-win32-arm64-msvc cache-miss
39 http fetch GET 200 https://registry.npmjs.org/@ast-grep%2fnapi-linux-x64-gnu 1762ms (cache revalidated)
40 silly packumentCache full:https://registry.npmjs.org/@ast-grep%2fnapi-linux-x64-gnu set size:225957 disposed:false
41 http fetch GET 200 https://registry.npmjs.org/@ast-grep%2fnapi-win32-arm64-msvc 1791ms (cache revalidated)
42 silly packumentCache full:https://registry.npmjs.org/@ast-grep%2fnapi-win32-arm64-msvc set size:197452 disposed:false
43 http fetch GET 200 https://registry.npmjs.org/@ast-grep%2fnapi-win32-x64-msvc 1807ms (cache revalidated)
44 silly packumentCache full:https://registry.npmjs.org/@ast-grep%2fnapi-win32-x64-msvc set size:224613 disposed:false
45 http fetch GET 200 https://registry.npmjs.org/@ast-grep%2fnapi-darwin-arm64 1829ms (cache revalidated)
46 silly packumentCache full:https://registry.npmjs.org/@ast-grep%2fnapi-darwin-arm64 set size:223517 disposed:false
47 http fetch GET 200 https://registry.npmjs.org/@ast-grep%2fnapi-darwin-x64 1880ms (cache revalidated)
48 silly packumentCache full:https://registry.npmjs.org/@ast-grep%2fnapi-darwin-x64 set size:209123 disposed:false
49 http fetch GET 200 https://registry.npmjs.org/@ast-grep%2fnapi-win32-ia32-msvc 1908ms (cache revalidated)
50 silly packumentCache full:https://registry.npmjs.org/@ast-grep%2fnapi-win32-ia32-msvc set size:196688 disposed:false
51 silly placeDep ROOT @ast-grep/napi-darwin-arm64@0.11.0 OK for: @ast-grep/napi@0.11.0 want: 0.11.0
52 silly placeDep ROOT @ast-grep/napi-darwin-x64@0.11.0 OK for: @ast-grep/napi@0.11.0 want: 0.11.0
53 silly placeDep ROOT @ast-grep/napi-linux-x64-gnu@0.11.0 OK for: @ast-grep/napi@0.11.0 want: 0.11.0
54 silly placeDep ROOT @ast-grep/napi-win32-arm64-msvc@0.11.0 OK for: @ast-grep/napi@0.11.0 want: 0.11.0
55 silly placeDep ROOT @ast-grep/napi-win32-ia32-msvc@0.11.0 OK for: @ast-grep/napi@0.11.0 want: 0.11.0
56 silly placeDep ROOT @ast-grep/napi-win32-x64-msvc@0.11.0 OK for: @ast-grep/napi@0.11.0 want: 0.11.0
57 silly reify moves {}
58 silly audit bulk request {
58 silly audit   '@shopify/create-hydrogen': [ '5.0.11' ],
58 silly audit   '@ast-grep/napi': [ '0.11.0' ],
58 silly audit   '@ast-grep/napi-darwin-arm64': [ '0.11.0' ],
58 silly audit   '@ast-grep/napi-darwin-x64': [ '0.11.0' ],
58 silly audit   '@ast-grep/napi-linux-x64-gnu': [ '0.11.0' ],
58 silly audit   '@ast-grep/napi-win32-arm64-msvc': [ '0.11.0' ],
58 silly audit   '@ast-grep/napi-win32-ia32-msvc': [ '0.11.0' ],
58 silly audit   '@ast-grep/napi-win32-x64-msvc': [ '0.11.0' ]
58 silly audit }
59 verbose reify failed optional dependency /home/daryl/.npm/_npx/c78eec8d27f8df64/node_modules/@ast-grep/napi-win32-x64-msvc
60 silly reify mark deleted [
60 silly reify   '/home/daryl/.npm/_npx/c78eec8d27f8df64/node_modules/@ast-grep/napi-win32-x64-msvc'
60 silly reify ]
61 verbose reify failed optional dependency /home/daryl/.npm/_npx/c78eec8d27f8df64/node_modules/@ast-grep/napi-win32-ia32-msvc
62 silly reify mark deleted [
62 silly reify   '/home/daryl/.npm/_npx/c78eec8d27f8df64/node_modules/@ast-grep/napi-win32-ia32-msvc'
62 silly reify ]
63 verbose reify failed optional dependency /home/daryl/.npm/_npx/c78eec8d27f8df64/node_modules/@ast-grep/napi-win32-arm64-msvc
64 silly reify mark deleted [
64 silly reify   '/home/daryl/.npm/_npx/c78eec8d27f8df64/node_modules/@ast-grep/napi-win32-arm64-msvc'
64 silly reify ]
65 verbose reify failed optional dependency /home/daryl/.npm/_npx/c78eec8d27f8df64/node_modules/@ast-grep/napi-darwin-x64
66 silly reify mark deleted [
66 silly reify   '/home/daryl/.npm/_npx/c78eec8d27f8df64/node_modules/@ast-grep/napi-darwin-x64'
66 silly reify ]
67 verbose reify failed optional dependency /home/daryl/.npm/_npx/c78eec8d27f8df64/node_modules/@ast-grep/napi-darwin-arm64
68 silly reify mark deleted [
68 silly reify   '/home/daryl/.npm/_npx/c78eec8d27f8df64/node_modules/@ast-grep/napi-darwin-arm64'
68 silly reify ]
69 silly tarball no local data for @shopify/create-hydrogen@https://registry.npmjs.org/@shopify/create-hydrogen/-/create-hydrogen-5.0.11.tgz. Extracting by manifest.
70 http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 374ms
71 silly audit report {}
72 http fetch GET 200 https://registry.npmjs.org/@shopify/create-hydrogen/-/create-hydrogen-5.0.11.tgz 1328ms (cache miss)
73 verbose stack Error: command failed
73 verbose stack     at promiseSpawn (/home/daryl/.nvm/versions/node/v20.18.0/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:22:22)
73 verbose stack     at spawnWithShell (/home/daryl/.nvm/versions/node/v20.18.0/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:124:10)
73 verbose stack     at promiseSpawn (/home/daryl/.nvm/versions/node/v20.18.0/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:12:12)
73 verbose stack     at runScriptPkg (/home/daryl/.nvm/versions/node/v20.18.0/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/run-script-pkg.js:77:13)
73 verbose stack     at runScript (/home/daryl/.nvm/versions/node/v20.18.0/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/run-script.js:9:12)
73 verbose stack     at run (/home/daryl/.nvm/versions/node/v20.18.0/lib/node_modules/npm/node_modules/libnpmexec/lib/run-script.js:48:10)
73 verbose stack     at async exec (/home/daryl/.nvm/versions/node/v20.18.0/lib/node_modules/npm/node_modules/libnpmexec/lib/index.js:293:10)
73 verbose stack     at async Init.execCreate (/home/daryl/.nvm/versions/node/v20.18.0/lib/node_modules/npm/lib/commands/init.js:136:5)
73 verbose stack     at async Init.exec (/home/daryl/.nvm/versions/node/v20.18.0/lib/node_modules/npm/lib/commands/init.js:44:14)
73 verbose stack     at async Npm.exec (/home/daryl/.nvm/versions/node/v20.18.0/lib/node_modules/npm/lib/npm.js:207:9)
74 error code 1
75 error path /home/daryl/repos
76 error command failed
77 error command sh -c create-hydrogen
78 verbose cwd /home/daryl/repos
79 verbose os Linux 5.15.153.1-microsoft-standard-WSL2
80 verbose node v20.18.0
81 verbose npm  v10.8.2
82 verbose exit 1
83 verbose code 1
84 error A complete log of this run can be found in: /home/daryl/.npm/_logs/2024-11-05T02_49_31_754Z-debug-0.log

hmmm just noticed this on the docs:

Requirements"
Node.js v16.20+ and npm v8.19+
echo "Node: $(node -v) | NPM: $(npm -v) | PNPM: $(pnpm -v 2>/dev/null || echo 'not installed') | NPX: $(npx -v 2>/dev/null || echo 'not installed') | NVM: $(nvm -v 2>/dev/null || echo 'not installed')"
Node: v20.18.0 | NPM: 10.8.2 | PNPM: 9.12.3 | NPX: 10.2.2 | NVM: 0.39.7

Help!

I think this error was throwing me as I’m new to hydrogen. It appears I needed to set up hydrogen in my shopify store before any of this would work.

1 Like