Laravel:无法找到字体依赖项
Posted
技术标签:
【中文标题】Laravel:无法找到字体依赖项【英文标题】:Laravel: unable to find font dependencies 【发布时间】:2017-07-31 21:26:07 【问题描述】:我全新安装了 Laravel,但无法让 npm run dev
成功运行:
未找到这些依赖项:
bootstrap-sass/assets/fonts/bootstrap/glyphicons-halflings-regular.eot 在 ./~/css-loader!./~/postcss-loader!./~/resolve-url-loader!./~/sass-loader/lib/loader.js?"precision":8,"outputStyle" :"expanded","sourceMap":true!./resources/assets/sass/app.scss bootstrap-sass/assets/fonts/bootstrap/glyphicons-halflings-regular.woff2 在 ./~/css-loader!./~/postcss-loader!./~/resolve-url-loader!./~/sass-loader/lib/loader.js?"precision":8,"outputStyle" :"expanded","sourceMap":true!./resources/assets/sass/app.scss bootstrap-sass/assets/fonts/bootstrap/glyphicons-halflings-regular.woff 在 ./~/css-loader!./~/postcss-loader!./~/resolve-url-loader!./~/sass-loader/lib/loader.js?"precision":8,"outputStyle" :"expanded","sourceMap":true!./resources/assets/sass/app.scss bootstrap-sass/assets/fonts/bootstrap/glyphicons-halflings-regular.ttf 在 ./~/css-loader!./~/postcss-loader!./~/resolve-url-loader!./~/sass-loader/lib/loader.js?"precision":8,"outputStyle" :"expanded","sourceMap":true!./resources/assets/sass/app.scss bootstrap-sass/assets/fonts/bootstrap/glyphicons-halflings-regular.svg 在 ./~/css-loader!./~/postcss-loader!./~/resolve-url-loader!./~/sass-loader/lib/loader.js?"precision":8,"outputStyle" :"expanded","sourceMap":true!./resources/assets/sass/app.scss
浏览互联网寻找答案,我发现问题 #289 on Github 但建议的修复不起作用:
_variables.scss 的最后一行:
$icon-font-path: "~bootstrap-sass/assets/fonts/bootstrap/";
App.scss:
// Fonts
@import url(https://fonts.googleapis.com/css?family=Raleway:300,400,600);
// Variables
@import "variables";
// Bootstrap
@import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";
@import "_app";
我的 package.json:
"private": true,
"scripts":
"dev": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --watch-poll --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"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",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
,
"devDependencies":
"axios": "^0.15.3",
"babel-core": "^6.23.1",
"babel-loader": "^6.4.0",
"babel-preset-env": "^1.2.1",
"bootstrap-sass": "^3.3.7",
"cross-env": "^3.2.3",
"css-loader": "^0.27.1",
"jquery": "^3.1.1",
"laravel-mix": "^0.8.8",
"lodash": "^4.17.4",
"md5": "^2.2.1",
"node-sass": "^4.5.0",
"postcss-loader": "^1.3.3",
"resolve-url-loader": "^2.0.2",
"sass-loader": "^6.0.3",
"style-loader": "^0.13.2",
"vue": "^2.1.10",
"webpack": "^2.2.1"
有什么想法吗?提前谢谢!
【问题讨论】:
在我看来修复应该有效。我猜这是加载顺序问题。你在哪里@import
ing 变量文件?
@KoriJohnRoys,我已经更新了我的问题。它就在引导程序的上方。
【参考方案1】:
我设法通过恢复到以前版本的 package.json 让它工作。你可以在这里找到它:https://github.com/laravel/laravel/blob/c1643bf0c59b6864fc55e09cce3bfafc67d29e2a/package.json
【讨论】:
以上是关于Laravel:无法找到字体依赖项的主要内容,如果未能解决你的问题,请参考以下文章