Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
matanol opened this issue Jul 6, 2020 · 74 comments

Comments

@matanol
Copy link

matanol commented Jul 6, 2020

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

@phamtiendat1998
Copy link

me too :(

@GDownes
Copy link

GDownes commented Jul 6, 2020

I'm also receiving this issue. Haven't upgrade any packages.

Happening with both:

import 'fontsource-roboto';
and
import 'typeface-roboto';

@matanol
Copy link
Author

matanol commented Jul 6, 2020

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

@phamtiendat1998
Copy link

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 :((

@matanol
Copy link
Author

matanol commented Jul 6, 2020

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.

@phamtiendat1998
Copy link

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 :))

@amitaguptasd
Copy link

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 :))

I was getting same error and resolved it by this solution. Thanks

@nimin1
Copy link

nimin1 commented Jul 8, 2020

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

@Nanif
Copy link

Nanif commented Jul 8, 2020

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

@pumano
Copy link

pumano commented Jul 8, 2020

I got this when update my sass-loader or something else with vue, but I has 13x nodejs. After upgrade to latest 14x it fixed.

@nguyenquocdaile
Copy link

Upgrade node to version 14.5 will resolve this issue.

@imanrousta
Copy link

imanrousta commented Jul 8, 2020

I was getting the same error. Upgrading node to version 14.5 will resolve the issue. I had v13 Node.

@Silent9790
Copy link

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 :((

Me too. I will try to upgrade to 14.5 rn.

@naftalib
Copy link

naftalib commented Jul 9, 2020

14+ upgrade solved the prob!

@itz-Malc0m
Copy link

i had tried the solution and it worked, but this morning the same issue came up..... still getting the same error

@dodandeniya
Copy link

I have tried the solution and its works for me. Thanks for the solution.

@leotaozeng
Copy link

Upgrade node to version 14.5 works for me.

@RMartires
Copy link

after updating node to 14.5 my npm was giving an error "npm does not support Node.js v14.5.0"

if anyones stuck here use "npm install -g npm" it should fix it

@Leconomy
Copy link

Upgrade node to version 14.5 will resolve this issue.

Yes, its works for me!

@bumblebee338
Copy link

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 ! It's works for me too.

@AnnemarieKohler
Copy link

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.

@bumblebee338
Copy link

bumblebee338 commented Jul 14, 2020 via email

@SumitJadiya
Copy link

SumitJadiya commented Jul 14, 2020

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 [email protected]

This fixed my issue.

Else you can simply upgrade the node version.

@DianiSN
Copy link

DianiSN commented Jul 15, 2020

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

@hoanguyen2603
Copy link

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.

@vivekprro
Copy link

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 :))

By upgrading to node version 14.5 it really started working.
Thank you very much

@harryheman
Copy link

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

npm i [email protected]

@constantlyTiTi
Copy link

you can try
brew update
brew upgrade node
then your node will be the latest one.

@abbiranjan
Copy link

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 works for me also.
Thx a lot.

@harshakns
Copy link

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 [email protected]

2)install autoprefixer
npm install [email protected]

thanks to @harryheman @SumitJadiya

@ai
Copy link
Contributor

ai commented Sep 20, 2020

@harshakns

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

Because without a update this error will be repeated in the future in another dependency

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

You will loose all Autoprefixer updates by locking old version

@Sneha9807
Copy link

Sneha9807 commented Sep 21, 2020

All the above solutions didn't work for me so I have again installed the latest version of Node.js and then installed the create-react-app tool globally:
npm install -g create-react-app
And then used the following:
npx create-react-app reactapp

@celikonline
Copy link

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 [email protected]
  • 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 🙁

worked for me

@KostaVlev
Copy link

npm install npm@latest fixed the issue for me

@altran-fabian
Copy link

As mentioned upgrade node version to 14.5.0.
or node version below fix with:

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 [email protected]

This fixed my issue.

Else you can simply upgrade the node version.
thx to: @SumitJadiya @harryheman
#9273 (comment)

@RiteshGhorpade
Copy link

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 [email protected]
npm uninstall colorette
npm install [email protected]
npm install [email protected]

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

Then only it worked for me

@ai
Copy link
Contributor

ai commented Nov 5, 2020

@RiteshGhorpade it will be better for your case to downgrade to Node.js 12.

With Node.js 13 you will have only more problems in the future (since more packages start to use ESM and you have no security updates).

@stale
Copy link

stale bot commented Dec 19, 2020

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@stale stale bot added the stale label Dec 19, 2020
@idsus
Copy link

idsus commented Dec 21, 2020

Ok

@stale stale bot removed the stale label Dec 21, 2020
@mohitk-art
Copy link

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 [email protected]

This fixed my issue.

Else you can simply upgrade the node version.

its not working

@irfaanraza
Copy link

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

I got the same issue and after upgrading my node js version my issue is solved, and make sure to install create-react-app with npx

ximbal added a commit to ximbal/mermaid-live-editor that referenced this issue Mar 11, 2021
Without this update the docker build fails at step:

$ webpack build
internal/modules/cjs/loader.js:628
  throw e;
  ^

Error: No valid exports main found for '/home/node_modules/colorette'
    at resolveExportsTarget (internal/modules/cjs/loader.js:625:9)
    at applyExports (internal/modules/cjs/loader.js:502:14)
    at resolveExports (internal/modules/cjs/loader.js:551:12)
    at Function.Module._findPath (internal/modules/cjs/loader.js:657:22)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:960:27)
    at Function.Module._load (internal/modules/cjs/loader.js:855:27)
    at Module.require (internal/modules/cjs/loader.js:1033:19)
    at require (/home/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/home/node_modules/webpack-cli/lib/webpack-cli.js:10:66)
    at Module._compile (/home/node_modules/v8-compile-cache/v8-compile-cache.js:192:30) {
  code: 'MODULE_NOT_FOUND'
}
error Command failed with exit code 1.

It succeded when I updated to the 14.5 version.

facebook/create-react-app#9273
@tr0k
Copy link

tr0k commented May 7, 2021

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

npm i [email protected]

I am using Windows 7 and the latest working Node version is 13.6. Therefore to make it run the only option is to downgrade autoprefixer: npm i [email protected] Downgrading colorette module to 1.2.0 didn't help. The ultimate solution is to upgrade Node, however, it's not possible on Windows 7. Alternatively, one can try to compile it on a VM or with a docker image that supports Node 14+.

@iansu
Copy link
Contributor

iansu commented Jun 2, 2021

It looks like this issue can be resolved by upgrading to Node 14 so I'm going to close this issue.

@iansu iansu closed this as completed Jun 2, 2021
@its-me-Harsh-Anand
Copy link

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

I have windows 7 32 bit which does not support node version greater than 13.6, what should I do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests