Getting error while deploying Vite React project

I am using Vite to create React project. I am using Tailwind and Daisyui. When deploying the build does not work. It works correctly on my local computer. How can I solve this?

Oct 2 04:53:51 PM  ==> Using Node version 14.17.0 (default)
Oct 2 04:53:51 PM  ==> Docs on specifying a Node version: https://render.com/docs/node-version
Oct 2 04:53:52 PM  ==> Using Node version 14.17.0 (default)
Oct 2 04:53:52 PM  ==> Docs on specifying a Node version: https://render.com/docs/node-version
Oct 2 04:53:52 PM  ==> Using Ruby version 2.6.8 (default)
Oct 2 04:53:52 PM  ==> Docs on specifying a Ruby version: https://render.com/docs/ruby-version
Oct 2 04:54:24 PM  ==> Installing dependencies with npm...
Oct 2 04:54:42 PM  
Oct 2 04:54:42 PM  > esbuild@0.18.20 postinstall /opt/render/project/src/node_modules/esbuild
Oct 2 04:54:42 PM  > node install.js
Oct 2 04:54:42 PM  
Oct 2 04:54:43 PM  added 342 packages from 246 contributors and audited 366 packages in 18.164s
Oct 2 04:54:43 PM  
Oct 2 04:54:43 PM  107 packages are looking for funding
Oct 2 04:54:43 PM    run `npm fund` for details
Oct 2 04:54:43 PM  
Oct 2 04:54:43 PM  found 3 vulnerabilities (1 moderate, 2 high)
Oct 2 04:54:43 PM    run `npm audit fix` to fix them, or `npm audit` for details
Oct 2 04:54:49 PM  audited 366 packages in 5.338s
Oct 2 04:54:49 PM  
Oct 2 04:54:49 PM  107 packages are looking for funding
Oct 2 04:54:49 PM    run `npm fund` for details
Oct 2 04:54:49 PM  
Oct 2 04:54:49 PM  found 3 vulnerabilities (1 moderate, 2 high)
Oct 2 04:54:49 PM    run `npm audit fix` to fix them, or `npm audit` for details
Oct 2 04:55:00 PM  ==> Using Python version 3.7.10 (default)
Oct 2 04:55:00 PM  ==> Docs on specifying a Python version: https://render.com/docs/python-version
Oct 2 04:55:04 PM  ==> Running build command 'npm run build'...
Oct 2 04:55:05 PM  
Oct 2 04:55:05 PM  > jrc-transportation-tracker-client@0.0.0 build /opt/render/project/src
Oct 2 04:55:05 PM  > vite build
Oct 2 04:55:05 PM  
Oct 2 04:55:05 PM  vite v4.4.9 building for production...
Oct 2 04:55:05 PM  transforming...
Oct 2 04:55:06 PM  
Oct 2 04:55:06 PM  🌼 daisyUI 3.8.2 https://daisyui.com
Oct 2 04:55:07 PM  ✓ 16 modules transformed.
Oct 2 04:55:07 PM  ✓ built in 1.36s
Oct 2 04:55:07 PM  [vite:css] [postcss] Object.hasOwn is not a function
Oct 2 04:55:07 PM  file: /opt/render/project/src/src/index.css:undefined:undefined
Oct 2 04:55:07 PM  error during build:
Oct 2 04:55:07 PM  TypeError: [postcss] Object.hasOwn is not a function
Oct 2 04:55:07 PM      at /opt/render/project/src/node_modules/daisyui/src/theming/functions.js:73:19
Oct 2 04:55:07 PM      at Array.forEach (<anonymous>)
Oct 2 04:55:07 PM      at Object.convertColorFormat (/opt/render/project/src/node_modules/daisyui/src/theming/functions.js:44:27)
Oct 2 04:55:07 PM      at /opt/render/project/src/node_modules/daisyui/src/theming/functions.js:187:41
Oct 2 04:55:07 PM      at Array.forEach (<anonymous>)
Oct 2 04:55:07 PM      at Object.injectThemes (/opt/render/project/src/node_modules/daisyui/src/theming/functions.js:182:28)
Oct 2 04:55:07 PM      at mainFunction (/opt/render/project/src/node_modules/daisyui/src/index.js:68:43)
Oct 2 04:55:07 PM      at registerPlugins (/opt/render/project/src/node_modules/tailwindcss/lib/lib/setupContextUtils.js:794:61)
Oct 2 04:55:07 PM      at createContext (/opt/render/project/src/node_modules/tailwindcss/lib/lib/setupContextUtils.js:1196:5)
Oct 2 04:55:07 PM      at getContext (/opt/render/project/src/node_modules/tailwindcss/lib/lib/setupContextUtils.js:1253:19)
Oct 2 04:55:07 PM  npm ERR! code ELIFECYCLE
Oct 2 04:55:07 PM  npm ERR! errno 1
Oct 2 04:55:07 PM  npm ERR! jrc-transportation-tracker-client@0.0.0 build: `vite build`
Oct 2 04:55:07 PM  npm ERR! Exit status 1
Oct 2 04:55:07 PM  npm ERR!
Oct 2 04:55:07 PM  npm ERR! Failed at the jrc-transportation-tracker-client@0.0.0 build script.
Oct 2 04:55:07 PM  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Oct 2 04:55:07 PM  
Oct 2 04:55:07 PM  npm ERR! A complete log of this run can be found in:
Oct 2 04:55:07 PM  npm ERR!     /opt/render/.cache/_logs/2023-10-02T10_55_07_038Z-debug.log
Oct 2 04:55:07 PM  ==> Build failed 😞

Hi there,

I can see the following error from the logs you posted: [vite:css] [postcss] Object.hasOwn is not a function. Per Mozilla’s docs, that function requires Node v16.9.0. Render’s default Node version is v14.17.0.

Our docs explain how to upgrade a service’s Node version: https://render.com/docs/node-version.

Let us know if you have any further questions.

Regards,
Mike


Render Support Engineer, MT (UTC-6)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.