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! tailwind-react-demo7IE72HYHFFCVEZFT437SR8XR http://mail.com/100.1.0 watch:css: `postcss src/assets/tailwind.css -o src/assets/main.css`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the tailwind-react-demo7IE72HYHFFCVEZFT437SR8XR http://mail.com/100.1.0 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! tailwind-react-demo7IE72HYHFFCVEZFT437SR8XR http://mail.com/100.1.0 start: `npm run watch:css && react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the tailwind-react-demo7IE72HYHFFCVEZFT437SR8XR http://mail.com/100.1.0 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
Kenil Vasani
I had the same issue today, and solved it updating node to the latest version.
flatMap was introduced with nodejs 11, you are probably using a lower version, you can check it by running:
node -v
I suggest to manage 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 version just runnvm install node
To check if the node version you are using has changed you can run
node -v
again.