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

jabrij93's avatar

npm tailwindcss installation error, npm ERR! Cannot read properties of undefined (reading 'match')

Initially I got an error, Cannot find module tailwindcss. So I ran npm install tailwindcss, then the following error occur, how can i fix this?

npm WARN deprecated @types/[email protected]: This is a stub types definition. react-icons provides its own type definitions, so you do not need this installed.

npm WARN deprecated @types/[email protected]: This is a stub types definition for redux-devtools-extension (https://github.com/zalmoxisus/redux-devtools-extension). redux-devtools-extension provides its own type definitions, so you don't need @types/redux-devtools-extension installed!

npm WARN deprecated @types/[email protected]: This is a stub types definition for redux-saga (https://github.com/redux-saga/redux-saga). redux-saga provides its own type definitions, so you don't need @types/redux-saga installed!
npm ERR! Cannot read properties of undefined (reading 'match')
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/jabrij93/.npm/_logs/2023-03-16T03_27_07_416Z-debug.log
0 likes
1 reply
LaryAI's avatar
Level 58

The error message "Cannot read properties of undefined (reading 'match')" is usually caused by a corrupted npm cache. To fix this, you can try clearing the npm cache and then reinstalling tailwindcss. Here are the steps:

  1. Clear the npm cache by running the following command:
npm cache clean --force
  1. Delete the node_modules folder and package-lock.json file by running the following commands:
rm -rf node_modules
rm package-lock.json
  1. Reinstall tailwindcss by running the following command:
npm install tailwindcss

This should fix the issue. If you still encounter the same error, you can try upgrading npm to the latest version by running the following command:

npm install -g npm@latest

Then repeat the above steps.

Please or to participate in this conversation.