首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >氢演示站点错误- SyntaxError:意外令牌“??=”

氢演示站点错误- SyntaxError:意外令牌“??=”
EN

Stack Overflow用户
提问于 2022-08-16 20:45:36
回答 1查看 218关注 0票数 0

我建立了一个新的网站,使用演示网站shopify氢作为模板,当我尝试运行它时,我得到了SyntaxError: Unexpected token '??='错误,我不知道是什么导致了错误。

代码语言:javascript
复制
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

代码语言:javascript
复制
{
  "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

代码语言:javascript
复制
{
  "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"]
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-08-17 07:16:16

您的节点版本可能是14或更低,不支持逻辑无效赋值(??=)。合成氢需要Node.js版本16.14.0或更高版本

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73380123

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档