Php laravel无法从localhost获取webfonts
我想在我的Laravel项目中集成字体真棒。但是我有一个奇怪的错误 运行项目时,控制台中会显示错误:Php laravel无法从localhost获取webfonts,php,css,laravel,npm,Php,Css,Laravel,Npm,我想在我的Laravel项目中集成字体真棒。但是我有一个奇怪的错误 运行项目时,控制台中会显示错误: GET http://localhost/fonts/vendor/@fortawesome/fontawesome-free/webfa-solid-900.woff2?55071ae1abc18726e23174192ebc0b68 net::ERR_ABORTED 404 (Not Found) 以下是app.scss文件: // Fonts @import url('https://
GET http://localhost/fonts/vendor/@fortawesome/fontawesome-free/webfa-solid-900.woff2?55071ae1abc18726e23174192ebc0b68 net::ERR_ABORTED 404 (Not Found)
以下是app.scss文件:
// Fonts
@import url('https://fonts.googleapis.com/css?family=Nunito');
// Variables
@import 'variables';
$fa-font-path:"../webfonts";
// Bootstrap
@import '~bootstrap/scss/bootstrap';
@import '~admin-lte/dist/css/adminlte.css';
@import "~@fortawesome/fontawesome-free/scss/fontawesome.scss";
@import "~@fortawesome/fontawesome-free/scss/solid.scss";
@import "~@fortawesome/fontawesome-free/scss/brands.scss";
在上面,我已经导入了所有必需的文件
以下是package.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 --disable-host-check --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"
},
"devDependencies": {
"axios": "^0.19",
"bootstrap": "^4.0.0",
"cross-env": "^7.0",
"jquery": "^3.2",
"laravel-mix": "^5.0.1",
"lodash": "^4.17.19",
"popper.js": "^1.12",
"resolve-url-loader": "^2.3.1",
"sass": "^1.20.1",
"sass-loader": "^8.0.0",
"vue": "^2.5.17",
"vue-template-compiler": "^2.6.10"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^5.15.0",
"admin-lte": "^3.0.0-alpha.2"
}
}
在上面,我通过npm添加了依赖项
我不知道是哪里出的问题。我运行以下命令来解决此问题:
php artisan run dev
php artisan run watch
但我无法带着解决方案逃走。我怎样才能解决这个问题?提前感谢。请在.env文件中尝试
host = localhost:8000