我正在尝试将Tailwind安装到我的Laravel 5.8应用程序中,并且正在使用Laravel Mix。我已经安装了tailwind npm软件包并生成了一个tailwind配置文件。 resources / sass / app.scss 路径中存在一个文件,但是当我使用npm run watch
进行编译时,出现一个错误,即未找到依赖项。如何解决此问题并在Laravel 5.8项目中使用Tailwind?
ERROR Failed to compile with 1 errors 12:16:17 PM
This dependency was not found:
* /Users/connorleech/Projects/employbl/resources/sass/app.scss in multi ./resources/assets/js/app.js ./resources/sass/app.scss
To install it, you can run: npm install --save /Users/connorleech/Projects/employbl/resources/sass/app.scss
Asset Size Chunks Chunk Names
/js/app.js 2.37 MB 0 [emitted] [big] /js/app
ERROR in multi ./resources/assets/js/app.js ./resources/sass/app.scss
Module not found: Error: Can't resolve '/Users/connorleech/Projects/employbl/resources/sass/app.scss' in '/Users/connorleech/Projects/employbl'
@ multi ./resources/assets/js/app.js ./resources/sass/app.scss
这是我的 webpack.mix.js 文件:
let mix = require('laravel-mix');
const tailwindcss = require('tailwindcss');
mix.js('resources/assets/js/app.js', 'public/js').version();
mix.sass('resources/sass/app.scss', 'public/css')
.options({
processCssUrls: false,
postCss: [ tailwindcss('./tailwind.config.js') ],
});
这些是我的 package.json 中的依赖项:
"devDependencies": {
"axios": "^0.16.2",
"bootstrap": "^4.1.1",
"bootstrap-sass": "^3.3.7",
"cross-env": "^5.0.1",
"jquery": "^3.1.1",
"laravel-mix": "^1.0",
"lodash": "^4.17.11",
"popper.js": "^1.14.3",
"sass-loader": "^8.0.2",
"vue": "^2.5.15"
},
"dependencies": {
"laravel-vue-pagination": "^2.3.0",
"moment": "^2.24.0",
"npm": "^6.2.0",
"pleasejs": "^0.4.2",
"prod": "^1.0.1",
"querystring": "^0.2.0",
"run": "^1.4.0",
"tailwindcss": "^1.2.0",
"vue-multiselect": "^2.1.3",
"vue-router": "^2.8.1",
"vue-ua": "^1.5.0",
"vuex": "^3.1.0"
}