Next.js Discord

Discord Forum

vercel - failed production deployment "it looks like you're trying to use typescrpit"

Answered
Cape lion posted this in #help-forum
Open in Discord
Cape lionOP
It looks like you're trying to use TypeScript but do not have the required package(s) installed.
Please install typescript and @types/react by running:
npm install --save-dev typescript @types/react

but i do have the packages installed..
Answered by Cape lion
we figured this out @Z4NR34L - we had the wrong version of @types/react-dom, but the correct version of @types/react. once they matched it worked
View full answer

64 Replies

Cape lionOP
i tried everything at this point
the build runs locally
Cape lionOP
if i could get a better log that would be good too
obviously i reinstalled typescript and react types
Cape lionOP
i can build for dev
Hi, can you please share with us build logs from vercel and package.json for start? 😄
Cape lionOP
hi @Z4NR34L
package.json
build logs sometimes exit and sometimes dont depnding on how i set it uo
i tried putting hte postinstall script for prisma too, but it also didnt work
"scripts": {
    "build": "prisma generate && next build",
  "scripts": {
    "build": "next build",
    "postinstall": "prisma generate",
neither worked
it's not prisma error, but next build is returning that you are using ts without proper configuration
Cape lionOP
it builds on local...
try to recreate your package-lock file
did you make sure to set nextjs on your vercel build config?
Cape lionOP
@riský yes
@Z4NR34L try to recreate your package-lock file
Cape lionOP
i did that 😦
check branch names if you are checking same branch on local and vercel, and check if you have good tsconfg.json config as well
Cape lionOP
dev will deploy ok ("preview branch"
but main wiont deploy
{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "target": "es2017",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "incremental": true,
    "noUncheckedIndexedAccess": true,
    "paths": {
      "src/*": ["./src/*"],
      "DesignSystem/*": ["./src/components/DesignSystem/*"],
      "AuthPages/*": ["./src/components/AuthPages/*"],
      "DashPages/*": ["./src/components/DashPages/*"],
      "SettingsPages/*": ["./src/components/SettingsPages/*"],
      "server/*": ["./src/server/*"],
      "PrismaSchemas": ["./prisma/generated/zod"],
      "PrismaClient": ["./src/server/db/PrismaClient"],
      "PusherWebClient": ["./src/server/common/PusherWebClient"],
      "PusherServerClient": ["./src/server/common/PusherServerClient"]
    },
    "plugins": [
      {
        "name": "next"
      }
    ]
  },
  "include": [
    "next-env.d.ts",
    "**/*.ts",
    "**/*.js",
    "**/*.tsx",
    "**/*.cjs",
    "**/*.mjs",
    ".next/types/**/*.ts",
    "jest.config.js"
  ],
  "exclude": ["node_modules", ".**/__test__/*"]
}
ts config
thank you guys for looking btw
i hate the tsconfig
you are missing basePath in this config, just set it to basePath: "."
Cape lionOP
thanks
i hate tsconifg, it often kills a day
and check again if that helped, if not we will be looking further 😄
Cape lionOP
@Z4NR34L - at the root level?
just above "paths"
i meant line above, sry
Cape lionOP
yeah
Cape lionOP
oh
Cape lionOP
the ide likes the root level
baseUrl
sorry 😄
Cape lionOP
{
  "compilerOptions": {
    "baseUrl": ".",
  }
}
exacly
mb 😄
Cape lionOP
ok deploying
thanks so much for taking time to help with this shitty problem
fail
ill leave prisma generate out until this is solved right?
thing is it will build on local
and even dev branch.... wonder wy
@Z4NR34L any inishgt into that?
looks like your local changes are not pushed to rrepository to that build in vercel
pleease check if your respository changes are up to date with your local files
Cape lionOP
what makes you say that?
theyre up to date
Cape lionOP
@Z4NR34L What maeks you think that the local changes arent pushed?
that you still get error message about missing packages, we have now w options - You will make an reproduction repository, or if your repository is public you will share it’s url
Cape lionOP
good morning @Z4NR34L should typescript and @types/react be in dev depednacies? (they are... maybe i should move them to dependancies?)
is there a good fast way to make a reproduction repository?
/**
 * Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation.
 * This is especially useful for Docker builds.
 */
!process.env.SKIP_ENV_VALIDATION && (await import("./src/env/server.mjs"));

/** @type {import("next").NextConfig} */
const config = {
  typescript: {
    ignoreBuildErrors: true,
  },
  reactStrictMode: true,
  swcMinify: true,
  experimental: {
    swcPlugins: [["next-superjson-plugin", {}]],
  },
  compiler: {
    styledComponents: true,
  },
  i18n: {
    locales: ["en"],
    defaultLocale: "en",
  },
  images: {
    domains: ["lh3.googleusercontent.com"], //Domain of image host
  },
  async redirects() {
    return [
      {
        source: "/dashboard",
        destination: "/dashboard/pages", // Matched parameters can be used in the destination
        permanent: true,
      },
    ];
  },
};
export default config;

maybe somethingin here?
Cape lionOP
we figured this out @Z4NR34L - we had the wrong version of @types/react-dom, but the correct version of @types/react. once they matched it worked
Answer
Thats interesting that it gave such error 😄 Thanks for sharing solution!