Next.js Discord

Discord Forum

Can someone please help

Unanswered
Sokoke posted this in #help-forum
Open in Discord
SokokeOP
./node_modules/@mapbox/node-pre-gyp/lib/util/nw-pre-gyp/index.html
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
<!doctype html>
| <html>
| <head>

2 Replies

SokokeOP
Here is the package.json
{
  "name": "dashboard",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "prisma generate && next build",
    "start": "next start",
    "lint": "next lint"
  },
  "prisma": {
    "seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts"
  },
  "dependencies": {
    "@auth/prisma-adapter": "^1.0.0",
    "@next-auth/prisma-adapter": "^1.0.7",
    "@prisma/client": "^4.16.2",
    "@radix-ui/react-popover": "^1.0.6",
    "@types/bcrypt": "^5.0.0",
    "@types/react": "18.2.14",
    "@types/react-dom": "18.2.6",
    "autoprefixer": "10.4.14",
    "bcrypt": "^5.1.0",
    "eslint": "8.44.0",
    "eslint-config-next": "13.4.7",
    "kmenu": "^1.4.11-beta",
    "next": "13.4.7",
    "next-auth": "^4.22.1",
    "postcss": "8.4.24",
    "react": "18.2.0",
    "react-cmdk": "^1.3.9",
    "react-dom": "18.2.0",
    "react-hot-toast": "^2.4.1",
    "react-icons": "^4.10.1",
    "react-responsive": "^9.0.2",
    "stripe": "^12.11.0",
    "tailwindcss": "3.3.2"
  },
  "devDependencies": {
    "@types/node": "^20.3.3",
    "prisma": "^4.16.2",
    "ts-node": "^10.9.1",
    "typescript": "^5.1.6"
  },
  "description": "This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).",
  "main": "next.config.js",
  "repository": {
    "type": "git"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "browser": {
    "fs": false,
    "path": false,
    "os": false
  }
}

and the next config
/** @type {import('next').NextConfig} */
const nextConfig = {
    experimental: {
      serverComponentsExternalPackages: [
        '@prisma/client', 'bcrypt'
      ]
    }
  };
  
  module.exports = nextConfig;
  
SokokeOP
I've figured out that this file is causing the error
"use client"

import { stripe } from "@/app/components/utils/stripe"
import { getServerSession } from "next-auth";
import { authOptions } from "@/app/api/auth/[...nextauth]/route";
import { useState } from "react";

import prisma from "@/app/components/libs/prisma";

const stripeClient = stripe


const StripeFunctions = async () => {
    const [isLoading, setIsLoading] = useState(false);

    
    const session = await getServerSession(authOptions);

    const sessionData = JSON.stringify(session)
  
    const name = session?.user?.name
  
    setIsLoading(true);
    const user = await prisma.user.findUnique({
      where: {
        email: session?.user?.email as string,
      },
      select: {
        stripeCustomerId: true,
      },
    });
    setIsLoading(false);
    
  
    const stripeCustomerId = user?.stripeCustomerId
    return (
        <h2>
            Stripe Customer Identification: {stripeCustomerId}
        </h2>
    );
}
 
export default StripeFunctions

WHy?