簡體   English   中英

Shopify Hydrogen 演示站點錯誤 - SyntaxError: Unexpected token '??='

[英]Shopify Hydrogen Demo Site Error - SyntaxError: Unexpected token '??='

我使用 shopify 氫的演示站點作為模板設置了一個新站點,當我嘗試運行它時,我得到SyntaxError: Unexpected token '??='錯誤,我不確定是什么導致了錯誤。

9:35:23 PM [vite] Error when evaluating SSR module /node_modules/@shopify/hydrogen/dist/esnext/entry-server.js?v=dec8cd9a:
SyntaxError: Unexpected token '??='
    at new AsyncFunction (<anonymous>)

package.json

{
  "description": "Demo store template for @shopify/hydrogen",
  "version": "0.0.0",
  "license": "MIT",
  "private": true,
  "scripts": {
    "dev": "shopify hydrogen dev",
    "build": "shopify hydrogen build",
    "preview": "shopify hydrogen preview",
    "lint": "eslint --ext .js,.jsx,.ts,.tsx src",
    "lint-ts": "tsc --noEmit",
    "test": "WATCH=true vitest",
    "test:ci": "yarn build -t node && vitest run"
  },
  "devDependencies": {
    "@shopify/cli": "3.7.1",
    "@shopify/cli-hydrogen": "3.7.1",
    "@shopify/prettier-config": "^1.1.2",
    "@tailwindcss/forms": "^0.5.2",
    "@tailwindcss/typography": "^0.5.2",
    "@types/react": "^18.0.14",
    "eslint": "^8.18.0",
    "eslint-plugin-hydrogen": "^0.12.2",
    "playwright": "^1.22.2",
    "postcss": "^8.4.14",
    "postcss-import": "^14.1.0",
    "postcss-preset-env": "^7.6.0",
    "prettier": "^2.3.2",
    "tailwindcss": "^3.0.24",
    "typescript": "^4.7.4",
    "vite": "^3.0.8",
    "vitest": "^0.15.2"
  },
  "prettier": "@shopify/prettier-config",
  "dependencies": {
    "@headlessui/react": "^1.6.4",
    "@heroicons/react": "^1.0.6",
    "@shopify/hydrogen": "^1.2.0",
    "clsx": "^1.1.1",
    "graphql-tag": "^2.12.6",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-use": "^17.4.0",
    "title": "^3.4.4",
    "typographic-base": "^1.0.4"
  }
}

tsconfig

{
  "compilerOptions": {
    "target": "es5",
    "module": "esnext",
    "moduleResolution": "node",
    "lib": ["dom", "dom.iterable", "scripthost", "es2020"],
    "jsx": "react-jsx",
    "types": ["vite/client", "vitest/globals"],
    "strict": true,
    "esModuleInterop": true,
    "isolatedModules": true,
    "resolveJsonModule": true,
    "skipLibCheck": true,
    "paths": {
      "~/*": ["./src/*"]
    }
  },
  "exclude": ["node_modules", "dist"],
  "include": ["**/*.ts", "**/*.tsx"]
}

您的節點版本可能是 14 或更低,不支持邏輯無效分配 (??=) Shopify 氫氣需要 Node.js 版本 16.14.0 或更高版本

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM