简体   繁体   English

节点错误:resolve-url-loader: CSS 错误

[英]Node Error: resolve-url-loader: CSS error

I am trying to run a react project as dev server on my surface, and if gives me the error shown below and in the title.我正在尝试在我的表面上运行一个反应项目作为开发服务器,如果给我下面和标题中显示的错误。 When I am running the same config on my pc I am not having this problem.当我在我的电脑上运行相同的配置时,我没有遇到这个问题。 (I tried creating the same conditions, but it just wont work). (我尝试创造相同的条件,但它就是行不通)。

Error:错误:

./src/assets/scss/black-dashboard-pro-react.scss?v=1.0.0 (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-5-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--6-oneOf-5-3!./node_modules/sass-loader/lib/loader.js??ref--6-oneOf-5-4!./src/assets/scss/black-dashboard-pro-react.scss?v=1.0.0)
Error: resolve-url-loader: CSS error
  source-map information is not available at url() declaration (found orphan CR, try removeCR option)

Complete error from Browser Console: (Chrome)浏览器控制台的完整错误:(Chrome)

Fetch API cannot load file:///C:/Users/Max-T/Documents/Sources/StaffMangerV2/Oauth2Manager-Web/src/assets/scss/black-dashboard-pro-react.scss. URL scheme must be "http" or "https" for CORS request.
(anonymous) @ index.js:1679
s @ index.js:499
(anonymous) @ index.js:479
e.<computed> @ index.js:536
S @ index.js:1517
i @ index.js:1534
(anonymous) @ index.js:1541
(anonymous) @ index.js:1530
(anonymous) @ index.js:1699
(anonymous) @ index.js:1673
s @ index.js:499
(anonymous) @ index.js:479
e.<computed> @ index.js:536
S @ index.js:1517
i @ index.js:1534
(anonymous) @ index.js:1541
(anonymous) @ index.js:1530
q @ index.js:1726
I @ index.js:1658
G @ index.js:1817
(anonymous) @ index.js:1831
(anonymous) @ index.js:1848
(anonymous) @ index.js:1332
error (async)
u @ index.js:1334
K @ index.js:1847
ce @ index.js:1951
./node_modules/react-dev-utils/webpackHotDevClient.js @ webpackHotDevClient.js:38
__webpack_require__ @ bootstrap:785
fn @ bootstrap:150
0 @ store.js:18
__webpack_require__ @ bootstrap:785
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
index.js:1679 Fetch API cannot load file:///C:/Users/Max-T/Documents/Sources/StaffMangerV2/Oauth2Manager-Web/node_modules/resolve-url-loader/index.js. URL scheme must be "http" or "https" for CORS request.
(anonymous) @ index.js:1679
s @ index.js:499
(anonymous) @ index.js:479
e.<computed> @ index.js:536
S @ index.js:1517
i @ index.js:1534
(anonymous) @ index.js:1541
(anonymous) @ index.js:1530
(anonymous) @ index.js:1699
(anonymous) @ index.js:1673
s @ index.js:499
(anonymous) @ index.js:479
e.<computed> @ index.js:536
S @ index.js:1517
i @ index.js:1534
(anonymous) @ index.js:1541
(anonymous) @ index.js:1530
q @ index.js:1726
I @ index.js:1658
G @ index.js:1817
(anonymous) @ index.js:1831
(anonymous) @ index.js:1848
(anonymous) @ index.js:1332
error (async)
u @ index.js:1334
K @ index.js:1847
ce @ index.js:1951
./node_modules/react-dev-utils/webpackHotDevClient.js @ webpackHotDevClient.js:38
__webpack_require__ @ bootstrap:785
fn @ bootstrap:150
0 @ store.js:18
__webpack_require__ @ bootstrap:785
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
main.chunk.js:10 Uncaught Error: Module build failed (from ./node_modules/resolve-url-loader/index.js):
Error: resolve-url-loader: CSS error
  source-map information is not available at url() declaration (found orphan CR, try removeCR option)
  at file://C:\Users\Max-T\Documents\Sources\StaffMangerV2\Oauth2Manager-Web\src\assets\scss\black-dashboard-pro-react.scss:13239:3
    at encodeError (C:\Users\Max-T\Documents\Sources\StaffMangerV2\Oauth2Manager-Web\node_modules\resolve-url-loader\index.js:219:12)
    at onFailure (C:\Users\Max-T\Documents\Sources\StaffMangerV2\Oauth2Manager-Web\node_modules\resolve-url-loader\index.js:176:14)
    at Object../node_modules/css-loader/dist/cjs.js?!./node_modules/postcss-loader/src/index.js?!./node_modules/resolve-url-loader/index.js?!./node_modules/sass-loader/lib/loader.js?!./src/assets/scss/black-dashboard-pro-react.scss?v=1.0.0 (http://localhost:3000/static/js/main.chunk.js:10:7)
    at __webpack_require__ (http://localhost:3000/static/js/bundle.js:786:30)
    at fn (http://localhost:3000/static/js/bundle.js:151:20)
    at Object../src/assets/scss/black-dashboard-pro-react.scss?v=1.0.0 (http://localhost:3000/static/js/main.chunk.js:744:15)
    at __webpack_require__ (http://localhost:3000/static/js/bundle.js:786:30)
    at fn (http://localhost:3000/static/js/bundle.js:151:20)
    at Module../src/index.js (http://localhost:3000/static/js/main.chunk.js:9220:109)
    at __webpack_require__ (http://localhost:3000/static/js/bundle.js:786:30)
    at fn (http://localhost:3000/static/js/bundle.js:151:20)
    at Object.0 (http://localhost:3000/static/js/main.chunk.js:9988:18)
    at __webpack_require__ (http://localhost:3000/static/js/bundle.js:786:30)
    at checkDeferredModules (http://localhost:3000/static/js/bundle.js:46:23)
    at Array.webpackJsonpCallback [as push] (http://localhost:3000/static/js/bundle.js:33:19)
    at http://localhost:3000/static/js/main.chunk.js:1:85
./node_modules/css-loader/dist/cjs.js?!./node_modules/postcss-loader/src/index.js?!./node_modules/resolve-url-loader/index.js?!./node_modules/sass-loader/lib/loader.js?!./src/assets/scss/black-dashboard-pro-react.scss?v=1.0.0 @ main.chunk.js:10
__webpack_require__ @ bootstrap:785
fn @ bootstrap:150
./src/assets/scss/black-dashboard-pro-react.scss?v=1.0.0 @ black-dashboard-pro-react.scss?v=1.0.0:1
__webpack_require__ @ bootstrap:785
fn @ bootstrap:150
./src/index.js @ index.css?e32c:37
__webpack_require__ @ bootstrap:785
fn @ bootstrap:150
0 @ store.js:18
__webpack_require__ @ bootstrap:785
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
index.js:1375 ./src/assets/scss/black-dashboard-pro-react.scss?v=1.0.0 (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-5-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--6-oneOf-5-3!./node_modules/sass-loader/lib/loader.js??ref--6-oneOf-5-4!./src/assets/scss/black-dashboard-pro-react.scss?v=1.0.0)
Error: resolve-url-loader: CSS error
  source-map information is not available at url() declaration (found orphan CR, try removeCR option)

I had this same error.我有同样的错误。 To fix this, I had to navigate to为了解决这个问题,我不得不导航到

node_modules/resolve-url-loader node_modules/resolve-url-loader

open打开

index.js index.js

and under var options change removeCR from "false" to "true".并在var options下将removeCR从“false”更改为“true”。

Another option would be to configure the IDE or Editor for the End of Line Sequence type, change from CRLF to LF... They are only alternatives... try it.另一种选择是将 IDE 或编辑器配置为行尾序列类型,从 CRLF 更改为 LF...它们只是替代品...尝试一下。

在此处输入图像描述

well, the solution must be related to some package configuration or something.嗯,解决方案一定和一些package配置什么的有关。 But I want to share the solution that I applied:但我想分享我应用的解决方案:

@import "variables";
@import "colored-balls";
@import "glowing-ball";
@import "pixel-loader";
@import "square-box";
@import "circle-loader";
@import "jumping-dots-loader";

Look for the file that cannot be resolved by the module in charge (Look for the error file).查找负责模块无法解析的文件(查找错误文件)。 with ctrl + click ... and comment one by one until you see which of them you did not read, when you found them: you can, comment on them, Or delete them.使用ctrl + 单击... 并逐一评论,直到您看到其中哪些您没有阅读,当您找到它们时:您可以评论它们,或者删除它们。 They are preloaders, I did not need them.它们是预加载器,我不需要它们。

/* @import "colored-balls"; /* @import "彩色球"; */ */

/* @import "pixel-loader"; /* @import "像素加载器"; */ */

In my case, I have recently updated Node.js to latest version & the dependencies for the some of the projects were not rebuilt.在我的例子中,我最近将 Node.js 更新到最新版本并且一些项目的依赖项没有重建。 So, I deleted existing dependencies & rebuilt them freshly.因此,我删除了现有的依赖项并重新构建了它们。 Then the error was gone.然后错误消失了。

rm -rf node_modules
npm install

Checkout git repo with:结帐 git 回购与:

[core]
    autocrlf = false

Because Windows CRLF are not supported by resolve-url-loader, using node-sass but Options not available to setup with Create-React-App.因为 resolve-url-loader 不支持 Windows CRLF,所以使用 node-sass 但选项不可用于使用 Create-React-App 进行设置。 See https://github.com/sass/node-sass/issues/2756https://github.com/sass/node-sass/issues/2756

Me I resolved the problem by installing resolve-url-loader component as below:我通过安装 resolve-url-loader 组件解决了这个问题,如下所示:

Install via npm通过 npm安装

npm install resolve-url-loader --save-dev npm 安装 resolve-url-loader --save-dev

via yarn通过纱线

yarn add resolve-url-loader --dev yarn add resolve-url-loader --dev

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到模块:错误:无法解析“css-loader” - Module not found: Error: Can't resolve 'css-loader' css-loader将不再将css导入节点,从而引发错误 - css-loader will not import css into node anymore, throwing error 如何解决 `at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)` 和服务器选择错误 - How to resolve the `at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)` and server selection error 错误:无法解析模块“babel-loader” - Error: Cannot resolve module 'babel-loader' AngularJS ng服务错误未能在节点模块/ css-loader中编译错误 - AngularJS ng serve error failed to compile error in node modules/css-loader Create-react-app失败并出现错误:节点与css-loader不兼容 - Create-react-app failing with error: node incompatible with css-loader ERROR in./node_modules/css-loader?: ENOENT: no such file or directory node_modules/node-sass/vendor - ERROR in ./node_modules/css-loader?: ENOENT: no such file or directory node_modules/node-sass/vendor 找不到模块:错误:无法解析“/node_modules/html-webpack-plugin/lib/loader.js” - Module not found: Error: Can't resolve '/node_modules/html-webpack-plugin/lib/loader.js' 在节点函数中返回解决错误 - return resolve error in node function Webpack错误-无法解析“ tmp / build…”中的加载器 - Webpack error - can't resolve loader in 'tmp/build…'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM