繁体   English   中英

AngularJS ng服务错误未能在节点模块/ css-loader中编译错误

[英]AngularJS ng serve error failed to compile error in node modules/css-loader

在开发角度项目之前,我从未遇到过这种情况。 我在这个项目中使用了angular 2。 这是在项目目录中运行命令ng serve时出现的以下错误。

块{chartjs.module} chartjs.module.chunk.js,chartjs.module.chunk.js.map()13.6 kB {main} [渲染的]块{components.module} components.module.chunk.js,components.module .chunk.js.map()268 kB {主要} [渲染]块{dashboard.module} dashboard.module.chunk.js,dashboard.module.chunk.js.map()64.5 kB {主要} [渲染]块{icons.module} icons.module.chunk.js,icons.module.chunk.js.map()184 kB {主要} [渲染]块{inline} inline.bundle.js,inline.bundle.js.map( inline)5.83 kB [entry] [rendered]块{main} main.bundle.js,main.bundle.js.map(main)82 kB {vendor} [initial] [rendered]块{pages.module} pages.module .chunk.js,pages.module.chunk.js.map()18.5 kB {主} [渲染的]块{polyfills} polyfills.bundle.js,polyfills.bundle.js.map(polyfills)328 kB {inline} [初始[渲染]块{scripts} scripts.bundle.js,scripts.bundle.js.map(scripts)358 kB {inline} [初始] [渲染]块{styles} styles.bundle.js,styles.bundle。 js.map(样式)10.5 kB {inlin e} [初始] [渲染]块{vendor} vendor.bundle.js,vendor.bundle.js.map(供应商)3.53 MB [initial] [rendered]块{widgets.module} widgets.module.chunk.js, widgets.module.chunk.js.map()58.5 kB {main} [呈现]

./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模块构建失败:错误:ENOENT:没有此类文件或目录, scandir'/ home / jayzdevera / Documents / ad-fingerprinting / web / node_modules / node-sass / vendor'在Object.fs.readdirSync(fs.js:952:18)出现错误(native)时在Object.getInstalledBinaries(/ home / found的/jayzdevera/Documents/ad-fingerprinting/web/node_modules/node-sass/lib/extensions.js:124:13)(/ home / jayzdevera / Documents / ad-fingerprinting / web / node_modules / node-sass / lib /founds/errors.js:20:15)(Object.module.exports.missingBinary(/home/jayzdevera/Documents/ad-fingerprinting/web/node_modules/node-sass/lib/errors.js:15:5) /home/jayzdevera/Documents/ad-fingerprinting/web/node_modules/node-sass/lib/errors.js:45:5)在module.exports(/ home / jayzdevera / Documents / ad-fingerprinting / w eb / node_modules / node-sass / lib / binding.js:15:30)。 (/home/jayzdevera/Documents/ad-fingerprinting/web/node_modules/node-sass/lib/index.js:14:35)位于Object.Module._extensions的Module._compile(module.js:570:32)。 .js(module.js:579:10)在Module.load(module.js:487:32)在tryModuleLoad(module.js:446:12)在Function.Module._load(module.js:438:3)在Object的require(internal / module.js:20:19)的Module.require(module.js:497:17)处。 (/home/jayzdevera/Documents/ad-fingerprinting/web/node_modules/sass-loader/lib/loader.js:3:14)@ ./src/scss/style.scss 4:14-195 @ multi ./src /scss/style.scss

webpack:编译失败。

我的节点v是8.4.0

如果有人可以帮助,将不胜感激。 提前致谢。

Try including the built version of chart.js:

"scripts": ["../node_modules/chart.js/dist/Chart.bundle.min.js"],

or you need to add the path to your .angular-cli.json like this:
    "apps": [

        "scripts": [

            "../node_modules/chart.js/src/chart.js",

        ],

    ]

我自己找到了解决这个问题的方法。 下面的链接与我有相同的错误。 https://github.com/JeffreyWay/laravel-mix/issues/226

只需运行npm install node-sass

如果在运行npm install node sass时出现问题,请运行此命令。

npm install node-sass --no-bin-links

它解决了我的问题。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM