create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

can't run yarn build get issue from Css Minimizer plugin Error: Cannot find module 'normalize-url'

Open nieprzecietny opened this issue 3 years ago • 22 comments
trafficstars

Describe the bug

Can't build fresh project with yarn build

Did you try recovering your dependencies?

yes ❯ yarn --version 1.22.15

Which terms did you search for in User Guide?

Css Minimizer plugin Error: Cannot find module 'normalize-url'

Environment

npx create-react-app --info

Environment Info:

current version of create-react-app: 5.0.0 running from C:\Users\kowalski\AppData\Local\Yarn\Data\global\node_modules\create-react-app

System: OS: Windows 10 10.0.19043 CPU: (8) x64 Intel(R) Xeon(R) CPU E3-1505M v5 @ 2.80GHz Binaries: Node: 17.4.0 - C:\Files\nodejs17\node.EXE Yarn: 1.22.15 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 8.3.1 - C:\Files\nodejs17\npm.CMD Browsers: Chrome: Not Found Edge: Spartan (44.19041.1266.0), Chromium (97.0.1072.62) Internet Explorer: 11.0.19041.1202 npmPackages: react: ^17.0.2 => 17.0.2 react-dom: ^17.0.2 => 17.0.2 react-scripts: 5.0.0 => 5.0.0 npmGlobalPackages: create-react-app: Not Found

Steps to reproduce

(Write your steps here:)

  1. yarn create react-app my-app2 --template typescript
  2. cd my-app2
  3. yarn build

Expected behavior

should get builded app

Actual behavior

❯ yarn build yarn run v1.22.15 $ react-scripts build Creating an optimized production build... Failed to compile.

static/css/main.a6b5f62b.css from Css Minimizer plugin Error: Cannot find module 'normalize-url' Require stack:

  • D:\aaaa\my-app2\node_modules\postcss-normalize-url\dist\index.js
  • D:\aaaa\my-app2\node_modules\cssnano-preset-default\dist\index.js
  • D:\aaaa\my-app2\node_modules\cssnano\dist\index.js
  • D:\aaaa\my-app2\node_modules\css-minimizer-webpack-plugin\dist\minify.js
  • D:\aaaa\my-app2\node_modules\jest-worker\build\workers\threadChild.js image

Reproducible demo

my-app2-for-issue.zip

nieprzecietny avatar Jan 19 '22 07:01 nieprzecietny

please, need help i stuck on this

nieprzecietny avatar Jan 19 '22 08:01 nieprzecietny

Did you find any solution?

himzzhere avatar Feb 04 '22 03:02 himzzhere

Hello Guys, any update on this issue ?

mobcoder-ashu avatar Feb 04 '22 07:02 mobcoder-ashu

yes i faced the same issue , i solved it

anazbinnoushad avatar Feb 08 '22 10:02 anazbinnoushad

any workaround @anazbinnoushad pls ?

nieprzecietny avatar Feb 08 '22 10:02 nieprzecietny

i just looked all of my css files and found an error on one of my css file it was on a media query statement

anazbinnoushad avatar Feb 08 '22 11:02 anazbinnoushad

yarn add --dev postcss-normalize it worked for me

frontowiec avatar Feb 11 '22 10:02 frontowiec

any luck with this issue guys, I am stuck on this too

dheeraj-vanteru avatar Feb 16 '22 13:02 dheeraj-vanteru

Please anyone has any fix for this..?

unknownaloy avatar Feb 19 '22 07:02 unknownaloy

Failed to compile.

static/css/main.be5a105b.css from Css Minimizer plugin Error: Invalid mapping: {"generated":{"line":1,"column":3846},"source":"static/css/main.be5a105b.css","original":{"line":1368,"column":null},"name":null}

error Command failed with exit code 1.

I get a simular message to this issue above after updating from CRA4 to 5.

I fixed it bgy going through all css files in the project commenting out the whole file until this error goes away. Then going back thorugh re-instanting rules until I found the problematic bit.

So if you are getting this you have some invaild css, but you get no clue in the error as to where, and must spend ages doing a manual binary search of your codebase.

Gunner245 avatar Feb 21 '22 16:02 Gunner245

i just looked all of my css files and found an error on one of my css file it was on a media query statement

Mantap, thx brother, worked for me

mkbakhtiar avatar Jun 08 '22 11:06 mkbakhtiar

Hello Guys, any update on this issue ?

Just check the .css files, probably u have some syntax error there.....

bangelev avatar Jun 27 '22 10:06 bangelev

run into the same problem which was caused by a comment line (double backward slash) ....// , yarn build -works fine after removing those lines

ekramteyeb avatar Jul 13 '22 21:07 ekramteyeb

any workaround @anazbinnoushad pls ?

I tried to figure out your code problem and solved this way. First, remove your build folder and yarn.lock file, then, yarn install and then yarn build that is it, it works here : )

ekramteyeb avatar Jul 13 '22 21:07 ekramteyeb

please, need help i stuck on this

I tried to figure out your code problem and solved this way. First, remove your build folder and yarn.lock file, then, yarn install and then yarn build that is it, it works here : )

ekramteyeb avatar Jul 13 '22 21:07 ekramteyeb

I just removed the files from 'App.css' that React creates automatically and it worked for some reason

tudstk avatar Jul 16 '22 12:07 tudstk

I had the same issue, i had an error of sintax inside of one of my css file. I remove this error, and then i was able to compile my project correctly. Regards

Agustintrezza avatar Jul 25 '22 20:07 Agustintrezza

I ran into this error when trying to update several packages in my react project. I was trying to upgrade normalize-url v6.0.1 to v7.0.3, but this threw the error so I just stayed on 6.0.1.

jaj232 avatar Aug 29 '22 18:08 jaj232

For me was this piece of code that was blocking it: @font-face { font-family: 'MyFont'; src: url("./fonts/"); src: url("./fonts/?#iefix") format("embedded-opentype"); src: url("./fonts/11469c307f0de6481e3a04cc5d54ae93.woff2") format("woff2"); src: url("./fonts/11469c307f0de6481e3a04cc5d54ae93.woff") format("woff"); src: url("./fonts/11469c307f0de6481e3a04cc5d54ae93.ttf") format("truetype"); src: url("./fonts/11469c307f0de6481e3a04cc5d54ae93.svg#Uber Move Text") format("svg"); }

Diogo107 avatar Mar 24 '23 01:03 Diogo107

I had the same issue. I had an issue in my footer CSS where I used [ ] vs { }

Thank you everyone!

whiterice2020 avatar Mar 30 '23 14:03 whiterice2020

not build react js -> This Error can u find this solution !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

static/css/main.da4e6500.css from Css Minimizer plugin Error: Unexpected '/'. Escaping special characters with \ may help.

vinodseni avatar Aug 01 '23 17:08 vinodseni