3

我将在我的 laravel 项目中安装这个管理面板https://coreui.io/ (免费版)。它包含一个带有以下依赖项的 package.json 文件:

    "dependencies": {
    "@coreui/coreui": "^2.1.5",
    "@coreui/coreui-plugin-chartjs-custom-tooltips": "1.2.0",
    "@coreui/icons": "0.3.0",
    "bootstrap": "^4.2.1",
    "chart.js": "2.7.3",
    "core-js": "^2.6.1",
    "flag-icon-css": "^3.2.1",
    "font-awesome": "4.7.0",
    "jquery": "3.3.1",
    "pace-progress": "1.0.2",
    "perfect-scrollbar": "^1.4.0",
    "popper.js": "^1.14.6",
    "simple-line-icons": "2.4.1"
  },

所以我只是将这些依赖项放在我的 package.json 中并运行 npm installand npm run dev. 我项目的 packaje.json 是

{
  "private": true,
  "scripts": {
    "dev": "npm run development",
    "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "npm run development -- --watch",
    "watch-poll": "npm run watch -- --watch-poll",
    "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "prod": "npm run production",
    "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
  },
  "dependencies": {
    "@coreui/coreui": "^2.1.6",
    "@coreui/coreui-plugin-chartjs-custom-tooltips": "1.2.0",
    "@coreui/icons": "0.3.0",
    "bootstrap": "^4.2.1",
    "chart.js": "2.7.3",
    "core-js": "^2.6.1",
    "flag-icon-css": "^3.2.1",
    "font-awesome": "^4.7.0",
    "jquery": "3.3.1",
    "node-sass": "^4.11.0",
    "pace": "*",
    "pace-progress": "1.0.2",
    "perfect-scrollbar": "^1.4.0",
    "popper.js": "^1.14.6",
    "simple-line-icons": "^2.4.1"
  },
  "devDependencies": {
    "axios": "^0.18",
    "bootstrap": "^4.0.0",
    "cross-env": "^5.1",
    "css-loader": "^2.1.0",
    "jquery": "^3.2",
    "laravel-mix": "^4.0.7",
    "lodash": "^4.17.5",
    "popper.js": "^1.12",
    "resolve-url-loader": "^2.3.1",
    "sass": "^1.15.2",
    "sass-loader": "^7.1.0",
    "style-loader": "^0.23.1",
    "vue": "^2.5.17",
    "vue-template-compiler": "^2.6.3"
  }
}

但结果我看到以下内容:

在此处输入图像描述

那么,我该如何解决呢?怎么了?

4

1 回答 1

2

首先确保您已成功安装所有软件包。我个人建议你删除你的node_modulesthen run npm install

我认为问题在于您的项目没有找到它的 CSS/SASS 依赖项。确保将所有 CSS/SASS 文件导入到您的app.scss文件中。例如,对于 Simple Line Icons 包,您应该这样做。

@import "~simple-line-icons/scss/simple-line-icons";

还要仔细检查所有js。组件 例如在您的app.js

import 'coreui';

于 2019-02-12T12:50:37.560 回答