gpt4 book ai didi

node.js - 当我尝试将我的 Angular 应用程序部署到 heroku 时,在 multi ./src/styles.scss 中出现错误

转载 作者:太空狗 更新时间:2023-10-29 18:35:17 24 4
gpt4 key购买 nike

当我尝试将我的 Angular 应用程序部署到 heroku 时,我遇到了一个奇怪的错误。

我试过在 angular.json 中切换样式路径,但这似乎无法解决问题。我很确定这是一个路径问题,但我似乎无法修复它。

这表明我已经将它从“sass 切换到 scss”

"@schematics/angular:component": {"style": "scss"}

这是我目前的路径

"styles": ["src/styles/global/global-styles.scss"]

这是我的 global-styles.scss

@import "~font-awesome/css/font-awesome.css";
@import "~bootstrap/dist/css/bootstrap.css";

我想让它构建到 heroku,但它被拒绝并给我这个错误:

remote: ERROR in multi ./src/styles.scss ../node_modules/font-awesome/css/font-awesome.css
remote: Module not found: Error: Can't resolve '/tmp/node_modules/font-awesome/css/font-awesome.css' in '/tmp/build_e2cd2f4e9e4c7e4749537f06bef83c35'

最佳答案

我相信问题出在这些行

@import "~font-awesome/css/font-awesome.css";
@import "~bootstrap/dist/css/bootstrap.css";

您的产品源代码找不到包含这两个包的 node_modules 文件夹。所以我建议你在你的 angular.json 中包含这样的 css

"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"node_modules/font-awesome/css/font-awesome.min.css"
],

关于node.js - 当我尝试将我的 Angular 应用程序部署到 heroku 时,在 multi ./src/styles.scss 中出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57368083/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com