Found orphan CR, try removeCR option with Create-React-App
- NPM version (
npm -v):6.12.0 - Node version (
node -v):v12.12.0 - Node Process (
node -p process.versions):{ node: '12.12.0', v8: '7.7.299.13-node.12', uv: '1.32.0', zlib: '1.2.11', brotli: '1.0.7', ares: '1.15.0', modules: '72', nghttp2: '1.39.2', napi: '5', llhttp: '1.1.4', http_parser: '2.8.0', openssl: '1.1.1d', cldr: '35.1', icu: '64.2', tz: '2019a', unicode: '12.1' } - Node Platform (
node -p process.platform):win32 - Node architecture (
node -p process.arch):x64 - node-sass version (
node -p "require('node-sass').info"):node-sass 4.12.0 (Wrapper) [JavaScript] libsass 3.5.4 (Sass Compiler) [C/C++] - npm node-sass versions (
npm ls node-sass):-- [email protected]
Getting the following error when running a create-react-app program. It works fine on another computer, but when cloned from git to this computer, I'm getting this error. The problem goes away if I comment out a url() to an image. The issue doesn't look like it's coming directly from node-sass, but it's the only library I have installed for styling.
Error: resolve-url-loader: CSS error
source-map information is not available at url() declaration (found orphan CR, try removeCR option)```
Looks like you have a problem with line endings. Make sure all your files have consistent line endings, preferably just LF.
More explanation why source maps should not have their line endings edited https://github.com/sass/libsass/issues/2820#issuecomment-482675671
There is not enough information to troubleshoot this, you might want to reduce that to a smallest case that involves node-sass.
I had CRLF for both computers, but apparently reducing it to just LF worked. Thanks!
What is LF ? please explain.
LF just means new line ("\n", insead of CRLF, ie "\r\n")
(BTW, replacing CRLF by LF in all scss files worked like a charm in my case)
Cheers!
@saper I also got this error. While replacing CRLF with LF worked, I did not settle for that solution since I did not have inconsistent EOL (I had only CRLF, using git core.autocrlf=true) so it should work.
I narrowed down what scss files caused the error and after wading through a couple of thousand lines I found that this diff solved the problem:
- font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue',
- Helvetica, sans-serif;
+ font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, sans-serif;
- animation: fill 0.4s ease-in-out 0.4s forwards,
- scale 0.3s ease-in-out 0.9s both;
+ animation: fill 0.4s ease-in-out 0.4s forwards, scale 0.3s ease-in-out 0.9s both;
So, this bug is probably an issue related to CRLF "inside a value". I thought that would be useful to you.
@Ziaul53 👆 probably also useful to you if you currently have this issue.
Ok, I changed CRLF TO LF and the problem is gone
For future readers since this post helped but didn't enable me to correct problem by itself. Getting it to run on Windows :
-
node_modules/resolve-url-loader/index.js => removeCR: false >> removeCR: true
-
package.json => "build": "GENERATE_SOURCEMAP=false react-scripts build" >> "build": "set "GENERATE_SOURCEMAP=false" && react-scripts build"
Edit: see comment below for solution that does not tamper with node modules which is probably a better idea on the long run
In addition to comments from @emilpalsson and @VirtualBlackWhale:
Also using Windows. I narrowed down the problem to just font imports at my place. When I manually remove all line endings "inside values", the build continues flawlessly. I hope this is helping enough for most devs, changing node_modules is not really an option for most devs, especially when using CI/CD environments...
In addition to comments from @emilpalsson and @VirtualBlackWhale:
Also using Windows. I narrowed down the problem to just font imports at my place. When I manually remove all line endings "inside values", the build continues flawlessly. I hope this is helping enough for most devs, changing node_modules is not really an option for most devs, especially when using CI/CD environments...
This did it for me, thanks!
When I manually remove all line endings "inside values" Can you please elaborate?
In addition to comments from @emilpalsson and @VirtualBlackWhale:
Also using Windows. I narrowed down the problem to just font imports at my place. When I manually remove all line endings "inside values", the build continues flawlessly. I hope this is helping enough for most devs, changing node_modules is not really an option for most devs, especially when using CI/CD environments...
Could you please define line ending inside values ? I'm not sure what you mean by that. Thanks !
Could you please define line ending inside values ? I'm not sure what you mean by that. Thanks !
@VirtualBlackWhale You can see what I mean in the diffs I posted earlier. I removed the line breaks in the values of font-family and animation in my scss. When they wrapped over two lines I got the error, when I removed the line break it worked.
Error:
font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue',
Helvetica, sans-serif;
Works:
font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, sans-serif;
@saper I also got this error. While replacing CRLF with LF worked, I did not settle for that solution since I did not have inconsistent EOL (I had only CRLF, using git core.autocrlf=true) so it should work.
I narrowed down what scss files caused the error and after wading through a couple of thousand lines I found that this diff solved the problem:
- font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', - Helvetica, sans-serif; + font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, sans-serif;- animation: fill 0.4s ease-in-out 0.4s forwards, - scale 0.3s ease-in-out 0.9s both; + animation: fill 0.4s ease-in-out 0.4s forwards, scale 0.3s ease-in-out 0.9s both;So, this bug is probably an issue related to CRLF "inside a value". I thought that would be useful to you.
This worked for me. Thanks
Has this been fixed in the meantime? The issue was simply closed, before @emilpalsson correctly narrowed the bug down and made it reproducable.
Could you please define line ending inside values ? I'm not sure what you mean by that. Thanks !
@VirtualBlackWhale You can see what I mean in the diffs I posted earlier. I removed the line breaks in the values of
font-familyandanimationin my scss. When they wrapped over two lines I got the error, when I removed the line break it worked.Error:
font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, sans-serif;Works:
font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, sans-serif;
this solution worked for me too!!!
I also ran into this same issue, and I had no clue how to fix it at first, these answers were helpful, but there was no way I could manually check thousands of lines of existing css code and I also knew that I don't want to temper with node_modules because even though it works, it is not maintainable on the long run, once the project is deployed somewhere from git node_modules will be created again and so this felt too hacky. So what I did was:
-
used
stylelintand to automatically locate and fix CRLF line ending (https://stylelint.io/user-guide/rules/linebreaks) -
changed
git configto avoid automatically changing these new LF line endings back to CRLF automatically - which is default behaviour - by settingautocrlf = falsein thegit configfile
I hope this helps some people out there.
For future readers since this post helped but didn't enable me to correct problem by itself. Getting it to run on Windows :
- node_modules/resolve-url-loader/index.js => removeCR: false >> removeCR: true
- package.json => "build": "GENERATE_SOURCEMAP=false react-scripts build" >> "build": "set "GENERATE_SOURCEMAP=false" && react-scripts build"
Edit: see comment below for solution that does not tamper with node modules which is probably a better idea on the long run
Thanks this was a short solution for me because I had a lot of .scss files.
In my case, all .scss files had to be converted from CRLF to LF inside my project folders. So I ran with my CMD (located on the project folder) this command:
for /R %f in (*.scss) do DOS2UNIX %f
"/R" is for apply it on every subdirectory file in the project folder.
Also checkout this way! Docker for Windows: Dealing With Windows Line Endings It seems like they solve it automatically for every further project.
For anyone still having this issue, I found a permanent solution for this. You can use .gitattributes to prevent the file from being converted to CRLF.
A .gitattributes file can look like this
*.vcproj eol=crlf
*.sh eol=lf
add
*.scss eol=lf
This setting forces Git to normalize line endings to LF on checkin and prevents conversion to CRLF when the file is checked out.
Just commit the .gitattributes file and your file will be checkout out on every system with LF line ending.
SOLUTION for me:
changed url(...) to URL(...) in scss files and works like a charm.