I created a React app and then integrated Tailwind to it. When I ran npm start
, I got this error.
TypeError: Object.entries(...).flatMap is not a function[![enter image description here][1]][1]
TypeError: Object.entries(...).flatMap is not a function
at flattenColorPalette (/media/rishi/142468BD2468A408/web/tailwind-react-demo/node_modules/tailwindcss/lib/util/flattenColorPalette.js:8:83)
at /media/rishi/142468BD2468A408/web/tailwind-react-demo/node_modules/tailwindcss/lib/plugins/divideColor.js:27:53
at plugins.forEach.plugin (/media/rishi/142468BD2468A408/web/tailwind-react-demo/node_modules/tailwindcss/lib/util/processPlugins.js:69:5)
at Array.forEach (<anonymous>)
at _default (/media/rishi/142468BD2468A408/web/tailwind-react-demo/node_modules/tailwindcss/lib/util/processPlugins.js:63:11)
at /media/rishi/142468BD2468A408/web/tailwind-react-demo/node_modules/tailwindcss/lib/processTailwindFeatures.js:60:54
at LazyResult.run (/media/rishi/142468BD2468A408/web/tailwind-react-demo/node_modules/postcss/lib/lazy-result.js:288:14)
at LazyResult.asyncTick (/media/rishi/142468BD2468A408/web/tailwind-react-demo/node_modules/postcss/lib/lazy-result.js:212:26)
at LazyResult.asyncTick (/media/rishi/142468BD2468A408/web/tailwind-react-demo/node_modules/postcss/lib/lazy-result.js:225:14)
at /media/rishi/142468BD2468A408/web/tailwind-react-demo/node_modules/postcss/lib/lazy-result.js:254:14
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] watch:css: `postcss src/assets/tailwind.css -o src/assets/main.css`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] watch:css script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/rishi/.npm/_logs/2020-11-19T08_16_39_825Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `npm run watch:css && react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/rishi/.npm/_logs/2020-11-19T08_16_39_906Z-debug.log
This is the GitHub repository: https://github.com/rishipurwar1/tailwind-react-demo.
I had the same issue today and solved it by updating Node.js to the latest version.
flatMap
was introduced with Node.js v11. You are probably using an older version. You can check it by running: node -v
.
I suggest managing node versions using NVM:
Very simple to install with cURL:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.0/install.sh | bash
Then restart your terminal, and to install the latest Node.js version just run nvm install node
.
To check if the Node.js version you are using has changed, you can run node -v
again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With