ChangoMan / nextjs-mdx-blog

UPDATED to Next.js App Router! Starter template built with Contentlayer, MDX, shadcn-ui, and Tailwind CSS.
https://nextjs-typescript-mdx-blog.vercel.app
385 stars 146 forks source link

Unexpected token '.' #5

Closed tiagokrebs closed 1 year ago

tiagokrebs commented 1 year ago

Right from the get started

git clone https://github.com/ChangoMan/nextjs-typescript-mdx-blog.git
cd nextjs-typescript-mdx-blog

npm install
npm run dev

this exception happens when opening any of the posts pages

" Server Error SyntaxError: Unexpected token '.'

This error happened while generating the page. Any console logs will be displayed in the terminal window. Call Stack Loader.moduleStrategy internal/modules/esm/translators.js (133:18) "

npm version
{
  'nextjs-typescript-mdx-blog': '1.0.0',
  npm: '8.5.1',
  node: '12.22.9',
  v8: '7.8.279.23-node.56',
  uv: '1.43.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '72',
  nghttp2: '1.43.0',
  napi: '8',
  llhttp: '2.1.4',
  http_parser: '2.9.4',
  openssl: '1.1.1m',
  cldr: '40.0',
  icu: '70.1',
  tz: '2022a',
  unicode: '14.0'
}
cat package.json
{
  "name": "nextjs-typescript-mdx-blog",
  "author": "@hunterhchang",
  "license": "MIT",
  "version": "1.0.0",
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "type-check": "tsc --pretty --noEmit",
    "format": "prettier --write .",
    "lint": "eslint . --ext ts --ext tsx --ext js",
    "test": "jest",
    "test-all": "yarn lint && yarn type-check && yarn test"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged",
      "pre-push": "yarn run type-check"
    }
  },
  "lint-staged": {
    "*.@(ts|tsx)": [
      "yarn lint",
      "yarn format"
    ]
  },
  "dependencies": {
    "@tailwindcss/typography": "^0.5.7",
    "date-fns": "^2.29.2",
    "gray-matter": "^4.0.3",
    "mdx-prism": "^0.3.4",
    "next": "^12.3.0",
    "next-mdx-remote": "^4.1.0",
    "next-themes": "^0.2.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  },
  "devDependencies": {
    "@testing-library/react": "^13.4.0",
    "@types/jest": "^29.0.1",
    "@types/node": "^18.7.17",
    "@types/react": "^18.0.19",
    "@typescript-eslint/eslint-plugin": "^5.37.0",
    "@typescript-eslint/parser": "^5.37.0",
    "autoprefixer": "^10.4.9",
    "babel-jest": "^29.0.3",
    "eslint": "^8.23.1",
    "eslint-config-next": "^12.3.0",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-react": "^7.31.8",
    "husky": "^8.0.1",
    "identity-obj-proxy": "^3.0.0",
    "jest": "^29.0.3",
    "jest-watch-typeahead": "^2.2.0",
    "lint-staged": "^13.0.3",
    "postcss": "^8.4.16",
    "prettier": "^2.7.1",
    "rehype": "^12.0.1",
    "rehype-autolink-headings": "6.1.1",
    "rehype-code-titles": "1.1.0",
    "rehype-prism-plus": "^1.5.0",
    "rehype-slug": "5.0.1",
    "remark-gfm": "^3.0.1",
    "tailwindcss": "^3.1.8",
    "typescript": "^4.8.3"
  }
}
ChangoMan commented 1 year ago

@tiagokrebs I could not reproduce this, I did a fresh clone and used npm install and I am able to go to the blog pages without issues.

Can you try from a fresh clone or try installing with yarn?