错误:找不到“@ionic/angular/css/display.css”

问题描述 投票:0回答:1

我正在将我的 ionic 项目从版本 4 迁移到版本 5。为此,我最初使用此命令安装了最新版本的 ionic 4

npm install @ionic/angular@^4.0.0

但现在它给了我这个错误

ERROR in ./src/global.scss (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/lib/loader.js??ref--15-3!./src/global.scss)
[ng] Module build failed (from ./node_modules/postcss-loader/src/index.js):
[ng] Error: Failed to find '@ionic/angular/css/display.css'
[ng]   in [
[ng]     D:\client\app\src
[ng]   ]
[ng]     at resolveModule.catch.catch (D:\client\app\node_modules\postcss-import\lib\resolve-id.js:35:13)

这是我的 global.scss

/*
 * App Global CSS
 * ----------------------------------------------------------------------------
 * Put style rules here that you want to apply globally. These styles are for
 * the entire app and not just one component. Additionally, this file can be
 * used as an entry point to import other CSS/Sass files to be included in the
 * output CSS.
 * For more information on global stylesheets, visit the documentation:
 * https://ionicframework.com/docs/layout/global-stylesheets
 */

/* Core CSS required for Ionic components to work properly */
@import "~@ionic/angular/css/core.css";

/* Basic CSS for apps built with Ionic */
@import "~@ionic/angular/css/normalize.css";
@import "~@ionic/angular/css/structure.css";
@import "~@ionic/angular/css/typography.css";
@import '~@ionic/angular/css/display.css';

/* Optional CSS utils that can be commented out */
@import "~@ionic/angular/css/padding.css";
@import "~@ionic/angular/css/float-elements.css";
@import "~@ionic/angular/css/text-alignment.css";
@import "~@ionic/angular/css/text-transformation.css";
@import "~@ionic/angular/css/flex-utils.css";

@import '~firebaseui/dist/firebaseui.css';


.address-modal{

    .modal-wrapper {
    position: absolute;  
    bottom: 0;  
    height: 80%;

  }
}

我不明白出了什么问题。 先谢谢你了

ionic-framework ionic4 angular8 ionic5
1个回答
0
投票

在 Angular 的更高版本中,不需要在从 node_modules 导入的 CSS 中添加波浪号 (~) 前缀,这会导致此错误。删除波形符,这将按预期工作(这是 4 年前的事情,但在 NX 工作区中新生成的 Ionic 项目中仍然是一个问题)

© www.soinside.com 2019 - 2024. All rights reserved.