我正在执行ng serve
,并且在生成块之后它无法编译。
同一个存储库正在同事的机器上工作,其版本如下:
也尝试过:
npm i
。已执行命令:ng serve
错误是:
ERROR in ./src/assets/css/style.css (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./src/assets/css/style.css)
Module build failed (from ./node_modules/postcss-loader/src/index.js):
TypeError: Cannot read property 'type' of undefined
at /home/akashj/workspace/projects/frontEnd/src/assets/css/style.css:1999:3
at stringifyNode (/home/akashj/workspace/projects/frontEnd/node_modules/postcss-value-parser/lib/stringify.js:2:19)
at Function.stringify (/home/akashj/workspace/projects/frontEnd/node_modules/postcss-value-parser/lib/stringify.js:45:10)
at Gradient.colorStops (/home/akashj/workspace/projects/frontEnd/node_modules/autoprefixer/lib/hacks/gradient.js:505:26)
at Gradient.oldWebkit (/home/akashj/workspace/projects/frontEnd/node_modules/autoprefixer/lib/hacks/gradient.js:398:10)
at Gradient.replace (/home/akashj/workspace/projects/frontEnd/node_modules/autoprefixer/lib/hacks/gradient.js:91:30)
at Gradient.add (/home/akashj/workspace/projects/frontEnd/node_modules/autoprefixer/lib/value.js:148:20)
at Gradient.add (/home/akashj/workspace/projects/frontEnd/node_modules/autoprefixer/lib/hacks/gradient.js:572:35)
at Gradient.process (/home/akashj/workspace/projects/frontEnd/node_modules/autoprefixer/lib/prefixer.js:157:16)
at /home/akashj/workspace/projects/frontEnd/node_modules/autoprefixer/lib/processor.js:327:15
at /home/akashj/workspace/projects/frontEnd/node_modules/postcss/lib/container.js:190:18
at /home/akashj/workspace/projects/frontEnd/node_modules/postcss/lib/container.js:135:18
at Rule.each (/home/akashj/workspace/projects/frontEnd/node_modules/postcss/lib/container.js:101:16)
at Rule.walk (/home/akashj/workspace/projects/frontEnd/node_modules/postcss/lib/container.js:131:17)
at /home/akashj/workspace/projects/frontEnd/node_modules/postcss/lib/container.js:148:24
at Root.each (/home/akashj/workspace/projects/frontEnd/node_modules/postcss/lib/container.js:101:16)
at Root.walk (/home/akashj/workspace/projects/frontEnd/node_modules/postcss/lib/container.js:131:17)
ℹ 「wdm」: Failed to compile.
对于ng serve
的整个控制台输出:https://pastebin.com/maHX3pCC
答案 0 :(得分:0)
我解决了。该行上的CSS(如下所示)在末尾有一个逗号,之后没有任何值。因此postcss会引发错误。
background-image: linear-gradient(to right, #973a95, #055faa, );
删除了逗号,并按预期工作
background-image: linear-gradient(to right, #973a95, #055faa);