Compilation error with react-scripts 4.0.0 ( Can't resolve file )
See original GitHub issuelatest update of react-scripts to 4.0.0 from 3.4.4 causes a compilation problem. With 3.4.4 it works, and the file exists
./src/styles/mycssfile.css
Error: Can't resolve '/images/module/filename.png' in 'D:\dev\workspace\xxxxxxxxx\src\styles'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! xxxxxxxxxxxxxxx@1.0.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the xxxxxxxxxxxxx@1.0.0 build 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! C:\Users\xxxxxxxxxxxxxx\AppData\Roaming\npm-cache\_logs\2020-10-23T16_16_47_530Z-debug.log
Issue Analytics
- State:
- Created 3 years ago
- Reactions:103
- Comments:70 (1 by maintainers)
Top Results From Across the Web
Can't resolve SCSS file after upgrade to create-react-app 4.0.1
So I spent all day trying to solve same error. Here's an issue on github on this: https://github.com/facebook/create-react-app/issues/9937.
Read more >module not found error can't resolve 'fs' react js - You.com
Your quick fix is to take react scripts down to v4 until a fix for v5 is in place unless you are comfortable...
Read more >Using React with TypeScript - Mattermost
Learn how to create a new TypeScript app with create-react-app and convert an existing create-react-app to TypeScript.
Read more >Module not found: Error: Can't resolve 'stream' in React project ...
I believe changing react-scripts to 4.0.3 and rerunning yarn install or npm install would've fixed this issue. There are several ways to get...
Read more >How to fix 'Module not found: Can't resolve 'http' in ... - YouTube
Basically, just change ' react - scripts ' to 4.0.2 in your package.json and run `npm install` again :D Follow me...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m also seeing this issue where we have an image in
/public
but it’s not getting resolved when reference in css usingurl
:.background-image { background: url('/bg.jpg'); }
Error:
./src/styles/style.css (./node_modules/css-loader/dist/cjs.js??ref--4-oneOf-4-1!./node_modules/postcss-loader/src??postcss!./src/styles/style.css) Error: Can't resolve '/bg.jpg' in '/mnt/c/git/application/src/styles'
Having a similar issue but with sass
url()
imports of images in the/public
folder