node.js ./node_modules/css-loader 中的错误?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46419024/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 18:30:14  来源:igfitidea点击:

ERROR in ./node_modules/css-loader?

node.jsangularnpm

提问by Jaaayz

I was trying to run an angular project in windows 10. It is the same project that I am doing in Ubuntu. When I clone the repository and install all the node packages I encountered this error.

我试图在 Windows 10 中运行一个 angular 项目。它与我在 Ubuntu 中所做的项目相同。当我克隆存储库并安装所有节点包时,我遇到了这个错误。

ERROR in ./node_modules/css-loader?{"sourceMap":false,"importLoaders":1}!./node_modules/postcss-loader?{"ident":"postcss"}!./node_modules/sass-loader/lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./src/scss/style.scss Module build failed: Error: ENOENT: no such file or directory, scandir 'C:\Users\Jaaayz\Documents\ad-fingerprinting\web\node_modules\node-sass\vendor' at Object.fs.readdirSync (fs.js:911:18) at Object.getInstalledBinaries (C:\Users\Jaaayz\Documents\ad-fingerprinting\web\node_modules\node-sass\lib\extensions.js:124:13) at foundBinariesList (C:\Users\Jaaayz\Documents\ad-fingerprinting\web\node_modules\node-sass\lib\errors.js:20:15) at foundBinaries (C:\Users\Jaaayz\Documents\ad-fingerprinting\web\node_modules\node-sass\lib\errors.js:15:5) at Object.module.exports.missingBinary (C:\Users\Jaaayz\Documents\ad-fingerprinting\web\node_modules\node-sass\lib\errors.js:45:5) at module.exports (C:\Users\Jaaayz\Documents\ad-fingerprinting\web\node_modules\node-sass\lib\binding.js:15:30) at Object. (C:\Users\Jaaayz\Documents\ad-fingerprinting\web\node_modules\node-sass\lib\index.js:14:35) at Module._compile (module.js:624:30) at Object.Module._extensions..js (module.js:635:10) at Module.load (module.js:545:32) at tryModuleLoad (module.js:508:12) at Function.Module._load (module.js:500:3) at Module.require (module.js:568:17) at require (internal/module.js:11:18) at Object. (C:\Users\Jaaayz\Documents\ad-fingerprinting\web\node_modules\sass-loader\lib\loader.js:3:14) at Module._compile (module.js:624:30) @ ./src/scss/style.scss 4:14-195 @ multi ./src/scss/style.scss

\Users\Jaaayz\Documents\ad-fingerprinting\web\node_modules\node-sass\lib\errors.js:15:5) 在 Object.module.exports.missingBinary (C:\Users\Jaaayz\Documents\ad-fingerprinting \web\node_modules\node-sass\lib\errors.js:45:5) 在 module.exports (C:\Users\Jaaayz\Documents\ad-fingerprinting\web\node_modules\node-sass\lib\binding.js :15:30) 在对象。(C:\Users\Jaaayz\Documents\ad-fingerprinting\web\node_modules\node-sass\lib\index.js:14:35) 在 Object.Module 的 Module._compile (module.js:624:30)。 _extensions..js (module.js:635:10) at Module.load (module.js:545:32) at tryModuleLoad (module.js:508:12) at Function.Module._load (module.js:500: 3) 在 Module.require (module.js:568:17) 在 require (internal/module.js:11:18) 在 Object。(C:

I tried googline it and do everything about it but didn't find any solution.

我尝试使用谷歌搜索它并对其进行了所有处理,但没有找到任何解决方案。

node -v 8.5.0

节点-v 8.5.0

Angular CLI version 1.4.3

Angular CLI 版本 1.4.3

Appreciate if someone calp help. Thanks in advance.

感谢有人帮助帮助。提前致谢。

回答by Fadi Abo Msalam

try using

尝试使用

npm rebuild node-sass

npm 重建 node-sass

回答by Akin Okegbile

$ npm install --save node-sass

This does the same as above. Similarly to the answer above.

这与上述相同。与上面的答案类似。

回答by Srikrushna

I am also facing the same problem, but I resolve.

我也面临同样的问题,但我解决了。

npm install node-sass  

Above command work for me. As per your synario you can use the blow command.

以上命令对我有用。根据您的synario,您可以使用blow 命令。

Try 1

尝试 1

 npm install node-sass

Try 2

尝试 2

remove node_modules folder and run npm install

Try 3

尝试 3

npm rebuild node-sass

Try 4

尝试 4

npm install --save node-sass

For your ref you can go through this github link

对于你的参考,你可以通过这个github 链接

回答by P Satish Patro

I tried both

我都试过了

npm rebuild node-sass

npm rebuild node-sass

and

npm install --save node-sass

npm install --save node-sass

Later by seeing EACCESS, i checked the folder permission of /node_modules, which was not 777 permission

后来看到EACCESS,查了一下/node_modules的文件夹权限,不是777权限

Then I gave

然后我给了

chmod -R 777 *

chmod -R 777 *

-R for recursively(setting the same permission not in the dir but also inside nested sub dir) * is for all files in current directory

-R 用于递归(不在目录中但也在嵌套子目录中设置相同的权限)* 用于当前目录中的所有文件

What is file permission

什么是文件权限

To check for permission you can use

要检查权限,您可以使用

ls -l

If u don't know about it, first see here, then check the url

如果你不知道,先看这里,然后检查网址

Every file and directory has permission of 'rwx'(read, write, execute). and if 'x' permission is not there, then you can not execture, if no 'w', you can not write into the file. if some thing is missiing it will show in place of r/w/x with '-'. So, if 'x' permission is not there, it will show like 'rw-'

每个文件和目录都有“rwx”(读、写、执行)权限。如果没有'x'权限,则不能执行,如果没有'w',则不能写入文件。如果缺少某些东西,它将用“-”代替 r/w/x。因此,如果“x”权限不存在,它将显示为“rw-”

And there will be 3 category of user Owner(who created the file/directory), Group(some people who shares same permission and user previlege), Others(general public)

并且将有 3 类用户所有者(创建文件/目录的人),组(一些共享相同权限和用户特权的人),其他人(公众)

So 1st letter is 'd'(if it is a directory) or '-'(if it is not a directory), followed by rwx for owner, followed by for group, followed by other

所以第一个字母是 'd'(如果它是一个目录)或 '-'(如果它不是一个目录),然后是 rwx 代表所有者,然后是组,然后是其他

drwxrwxrwx

For example, for 'node_modules'directory I want to give permission to owner all permission and for rest only read, then it will be

例如,对于 'node_modules' 目录,我想授予所有者所有权限,而其余的只能读取,那么它将是

drwxr--r--

And about the number assume for 'r/w/x' it is 1and for '-' it is 0, 777, first 7 is for owner, followed by group, followed by other

关于数字,假设 'r/w/x' 是1,而 '-' 是0,777,第一个 7 是所有者,然后是组,然后是其他

Let's assume the permission is rwxr-xrw-

让我们假设权限是rwxr-xrw-

Now 'rwx' is like '111' and it's equivalent decimal is 1*2^2+1*2^1+1*2^0=7

现在'rwx'就像'111',它的等效十进制是1*2^2+1*2^1+1*2^0=7

Now 'r-x' is like '101' and it's equivalent decimal is 1*2^2+0*2^1+1*2^0=5

现在'rx'就像'101',它的等效十进制是1*2^2+0*2^1+1*2^0=5

Now 'rw-' is like '110' and it's equivalent decimal is 1*2^2+1*2^1+0*2^0=6

现在'rw-'就像'110',它的等效十进制是1*2^2+1*2^1+0*2^0=6

So, it will be 756

所以,它将是 756

回答by Ali Raza

Laravel Mix 4 switches from node-sass to dart-sass (which may not compile as you would expect, OR you have to deal with the issues one by one)

Laravel Mix 4 从 node-sass 切换到 dart-sass(可能无法按照你的预期编译,或者你必须一一处理问题)

OR

或者

npm install node-sass


mix.sass('resources/sass/app.sass', 'public/css', {
implementation: require('node-sass')
});

https://laravel-mix.com/docs/4.0/upgrade

https://laravel-mix.com/docs/4.0/upgrade

回答by thilini liyanagama

you have to update your node.js and angular/cli.If you update these two things then your project has angular.json file instead of angular-cli.json file.Then add css file into angular.json file.If you add css file into angular-cli.json file instead of angular.json file,then errors are occured.

你必须更新你的 node.js 和 angular/cli。如果你更新这两个东西,那么你的项目有 angular.json 文件而不是 angular-cli.json 文件。然后将 css 文件添加到 angular.json 文件中。如果添加 css文件到 angular-cli.json 文件而不是 angular.json 文件,然后发生错误。

回答by Basar

Try to run

尝试运行

npm i node-sass@latest

npm i node-sass@latest