create-react-app: create-react-app starting error - Error: No valid exports main found for '\node_modules\colorette'

When installing create-react-app I get this error when I start the development server (npm start),

./src/index.css (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-3-1!./node_modules/postcss-loader/src??postcss!./src/index.css) Error: No valid exports main found for 'myproject\node_modules\colorette'

I’ve reinstalled create-react-app -g and tryed with npx and I still get this error. Is there anything else I can do?

this is the files of my new created react apps - without node_modules: newreactapp.zip

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 34
  • Comments: 74 (5 by maintainers)

Commits related to this issue

Most upvoted comments

Fixed this problem by upgrading node.js to v14.5, i’ve had v13.5 and v13.6 in my laptop. and also removing create-react-app globally: npm uninstall -g create-react-app

and using: npx create-react-app myapp

Upgrade node to version 14.5 will resolve this issue.

This is because latest version of colorette doesn’t supported on node Version < 14. Try below steps if you don’t want to install node V14.5

To uninstall colorette: npm uninstall colorette

To install colorette version 1.2.0: npm install colorette@1.2.0

This fixed my issue.

Else you can simply upgrade the node version.

I was installing on an existing project so I didn’t want to upgrade node. I had to downgrade colorette and autoprefixer. I am currently using node v13.2.0

npm uninstall colorette npm install colorette@1.2.0

npm uninstall autoprefixer npm install autoprefixer@9.8.0

Thanks (this was all based on your comments above.

We can fix this issue by installing autoprefixer. npm install autoprefixer

npm i autoprefixer@9.8.0

me too 😦

Thank you, update node version to 14.5 help me solve this error.

We can fix this issue by installing autoprefixer. npm install autoprefixer

Fixed this problem by upgrading node.js to v14.5, i’ve had v13.5 and v13.6 in my laptop. and also removing create-react-app globally: npm uninstall -g create-react-app and using: npx create-react-app myapp

It’s not working with me 😦(

I’ve downloaded the latest node.js version and installed it again, I didn’t manually upgraded it.

Thank you, It’s working 😃)

Fixed this problem by upgrading node.js to v14.5, i’ve had v13.5 and v13.6 in my laptop. and also removing create-react-app globally: npm uninstall -g create-react-app and using: npx create-react-app myapp

It’s not working with me 😦(

I’ve downloaded the latest node.js version and installed it again, I didn’t manually upgraded it.

Fixed this problem by upgrading node.js to v14.5, i’ve had v13.5 and v13.6 in my laptop. and also removing create-react-app globally: npm uninstall -g create-react-app

and using: npx create-react-app myapp

It’s not working with me 😦(

left my node version at 13.11.0 on Ubuntu 20.04 npm i autoprefixer@9.8.0 It’s working!

npm i autoprefixer@9.8.0 works for me with Node v13.3.0

Thank you @SumitJadiya this fixed the issue and did not have to upgrade node.

This error happens because of ESM bug in Node.js 13.

The right solution is not to downgrade Autoprefixer (since you will have more problem with ESM packages in the future), but to update Node.js to 14.x (also, Node.js 13 has no security updates, it is not safe to use it in production).

Two working solutions for me (from the thread above, thanks @SumitJadiya and @mattyusdev)

1. Install working version of colorette

  • In your projects directory run npm uninstall colorette
  • Then install a working version npm install colorette@1.2.0
  • npm start should now run without an issue

2. Upgrade node version to > 14

It would be great if create-react-app worked with the highest LTS version of Node though - sometimes we don’t have the luxury of using the current version 🙁

Fixed this problem by upgrading node.js to v14.5, i’ve had v13.5 and v13.6 in my laptop. and also removing create-react-app globally: npm uninstall -g create-react-app

and using: npx create-react-app myapp

Thank you. Its works.

AS I am on windows 7 still , I cannot upgrade to latest version of Node I am on Node 13.0.6

After Reading the comments only when did run these all commands , it worked for me

npm uninstall react-scripts npm install react-scripts@3.4.1 npm uninstall colorette npm install colorette@1.2.0 npm install autoprefixer@9.8.0

and After that I added import React from “react”; in App.js

Then only it worked for me

Fixed this problem by upgrading node.js to v14.5.0. After upgrading, I also had to delete my node_modules folder and rerun npm install.

why do we need to upgrade node just for a dependecy?

my setup: create-react-app 3.4.1 node -v13.2.0

the following steps worked for me.

  1. downgrade colorette to 1.2.0 npm uninstall colorette npm install colorette@1.2.0

2)install autoprefixer npm install autoprefixer@9.8.0

thanks to @harryheman @SumitJadiya

Nothing worked for me.

@dailepro thanks, it’s work for me

This is because latest version of colorette doesn’t supported on node Version < 14. Try below steps if you don’t want to install node V14.5

To uninstall colorette: npm uninstall colorette

To install colorette version 1.2.0: npm install colorette@1.2.0

This fixed my issue.

Else you can simply upgrade the node version.

Thank for you this. A much more appropriate solution for most people I would imagine then having to upgrade the entirety of node.

This is because latest version of colorette doesn’t supported on node Version < 14. Try below steps if you don’t want to install node V14.5

To uninstall colorette: npm uninstall colorette

To install colorette version 1.2.0: npm install colorette@1.2.0

This fixed my issue.

Else you can simply upgrade the node version.

Thank you i will work fine