Answer the question
In order to leave comments, you need to log in
What am I doing wrong when compiling files in laravel?
Hello! The essence of the problem is this:
In Laravel, you need to compile several css files into one css file and several js files into one js file, but this cannot be done. I've been learning Laravel not so long ago, hardly a week, so I would like to understand what I'm doing wrong?
When I type in node -v and npm -v in the terminal, their versions are shown, which indicates that they are installed.
I compile to Laraver in the webpack.mix.js file, I attach the file itself to show how I do it:
let mix = require('laravel-mix');
/*
|------------------------------------------------------------------------—
| Mix Asset Management
|------------------------------------------------------------------------—
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
mix.styles([
'resources/assets/css/libs/blog-post.css',
'resources/assets/css/libs/bootstrap.css',
'resources/assets/css/libs/bootstrap.min.css',
'resources/assets/css/libs/font-awesome.css',
'resources/assets/css/libs/metisMenu.css',
'resources/assets/css/libs/sb-admin-2.css',
'resources/assets/css/libs/styles.css',
'resources/assets/css/libs/timeline.css'
], '/public/css/libs.css');
mix.scripts([
'resources/assets/js/libs/bootstrap.js',
'resources/assets/js/libs/jquery.js',
'resources/assets/js/libs/metisMenu.js',
'resources/assets/js/libs/sb-admin-2.js'
], '/public/js/libs.js');
C:\OSPanel\domains\project>npm run dev
> @ dev C:\OSPanel\domains\project
> npm run development
> @ development C:\OSPanel\domains\project
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
module.js:549
throw err;
^
Error: Cannot find module 'C:\OSPanel\domains\project\node_modules\laravel-mix\setup\webpack.config.js'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at requireConfig (C:\OSPanel\domains\project\node_modules\webpack\bin\convert-argv.js:97:18)
at C:\OSPanel\domains\project\node_modules\webpack\bin\convert-argv.js:104:17
at Array.forEach (<anonymous>)
at module.exports (C:\OSPanel\domains\project\node_modules\webpack\bin\convert-argv.js:102:15)
at yargs.parse (C:\OSPanel\domains\project\node_modules\webpack\bin\webpack.js:171:41)
at Object.Yargs.self.parse (C:\OSPanel\domains\project\node_modules\yargs\yargs.js:533:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ПК\AppData\Roaming\npm-cache\_logs\2018-07-14T10_30_42_750Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ПК\AppData\Roaming\npm-cache\_logs\2018-07-14T10_30_42_963Z-debug.log
Answer the question
In order to leave comments, you need to log in
For those who encounter the same error: I
entered the following commands in the terminal and the compilation worked:
npm cache clear --force
npm install
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question