Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

AT03's avatar
Level 1

How to solve my problem? (npm run build)

$ npm run build

> build
> vite build

vite v3.1.0 building for production...
✓ 116 modules transformed.
[vite:css] [postcss] Cannot read properties of undefined (reading 'config')
file: /var/www/my_user/data/www/my_site/resources/sass/app.scss:undefined:undefined
error during build:
TypeError: [postcss] Cannot read properties of undefined (reading 'config')
    at getTailwindConfig (/var/www/my_user/data/www/my_site/node_modules/tailwindcss/lib/lib/setupTrackingContext.js:87:63)
    at /var/www/my_user/data/www/my_site/node_modules/tailwindcss/lib/lib/setupTrackingContext.js:129:92
    at /var/www/my_user/data/www/my_site/node_modules/tailwindcss/lib/processTailwindFeatures.js:46:11
    at plugins (/var/www/my_user/data/www/my_site/node_modules/tailwindcss/lib/index.js:33:63)
    at LazyResult.runOnRoot (/var/www/my_user/data/www/my_site/node_modules/postcss/lib/lazy-result.js:339:16)
    at LazyResult.runAsync (/var/www/my_user/data/www/my_site/node_modules/postcss/lib/lazy-result.js:393:26)
    at async compileCSS (file:///var/www/my_user/data/www/my_site/node_modules/vite/dist/node/chunks/dep-665b0112.js:44459:25)
    at async Object.transform (file:///var/www/my_user/data/www/my_site/node_modules/vite/dist/node/chunks/dep-665b0112.js:43963:55)
    at async transform (file:///var/www/my_user/data/www/my_site/node_modules/rollup/dist/es/shared/rollup.js:21928:16)
    at async ModuleLoader.addModuleSource (file:///var/www/my_user/data/www/my_site/node_modules/rollup/dist/es/shared/rollup.js:22153:30)
0 likes
13 replies
lbecket's avatar

Are you running npm run build from the root directory of your project?

2 likes
AT03's avatar
Level 1

@lbecket Hello! My actions are as follows: 1. I connect to the site user "my_user", 2. I execute the command "cd www/my_site"

The full path will be: "/var/www/my_user/data/www/my_site".

So I'm sure that I'm not running from the root directory or what did you mean? Everything was fine before, "npm run dev" starts.

kiri1101's avatar

I second @lbecket on this. Looks like you're not running npm run build in your root directory. Make sure you are in your root directory before running the command

1 like
AT03's avatar
Level 1

@kiri1101 Hello! My actions are as follows:

  1. I connect to the site user "my_user" (SSH),
  2. I execute the command "cd www/my_site". The full path will be: "/var/www/my_user/data/www/my_site".

So I'm sure that I'm not running from the root directory or what did you mean? Everything was fine before, "npm run dev" starts.

Snapey's avatar

does your project build locally?

1 like
AT03's avatar
Level 1

@Snapey No. At the VPS. This is the first error I've come across.

Sinnbeck's avatar

@AT03 Try running npm run build locally and see if it works there...

1 like
AT03's avatar
AT03
OP
Best Answer
Level 1

Just commented out "tailwind css: {}," in "postcss.config.js" file. Problem solved.

1 like
AT03's avatar
Level 1

@Sinnbeck But that was exactly the problem, deleted and there are no errors.

hex123's avatar

@AT03 i don't have the ''postcss.config.js'' file and i am still getting the same error

Please or to participate in this conversation.