Did you checked you app.scss file for any erros (Unclosed block,...)?
Feb 12, 2020
17
Level 1
Error npm run production
Wehn running npm production get error like bellow:
[hrace009@ko2svr hrace009.com]$ npm run prod
> @ prod /var/www/hrace009.com
> npm run production
> @ production /var/www/hrace009.com
> cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
ERROR Failed to compile with 2 errors 10:18:00 PM
error in ./resources/sass/app.scss
Syntax Error: ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/src/index.js):
SyntaxError
(259:4) Unclosed block
257 |
258 | .navbar-toggler-icon {
> 259 | background-image: escape-svg($navbar-light-toggler-icon-bg);
| ^
260 | }
261 |
error in ./resources/sass/app.scss
Syntax Error: SyntaxError
(259:4) Unclosed block
257 |
258 | .navbar-toggler-icon {
> 259 | background-image: escape-svg($navbar-light-toggler-icon-bg);
| ^
260 | }
261 |
@ ./resources/sass/app.scss 2:14-253
2 assets
ERROR in ./resources/sass/app.scss
Module build failed (from ./node_modules/css-loader/index.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/src/index.js):
SyntaxError
(259:4) Unclosed block
257 |
258 | .navbar-toggler-icon {
> 259 | background-image: escape-svg($navbar-light-toggler-icon-bg);
| ^
260 | }
261 |
at /var/www/hrace009.com/node_modules/webpack/lib/NormalModule.js:316:20
at /var/www/hrace009.com/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /var/www/hrace009.com/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/var/www/hrace009.com/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at /var/www/hrace009.com/node_modules/postcss-loader/src/index.js:207:9
@ ./resources/sass/app.scss
ERROR in ./resources/sass/app.scss (./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/src??postcss0!./node_modules/resolve-url-loader??ref--5-4!./node_modules/sass-loader/dist/cjs.js??ref--5-5!./resources/sass/app.scss)
Module build failed (from ./node_modules/postcss-loader/src/index.js):
SyntaxError
(259:4) Unclosed block
257 |
258 | .navbar-toggler-icon {
> 259 | background-image: escape-svg($navbar-light-toggler-icon-bg);
| ^
260 | }
261 |
@ ./resources/sass/app.scss 2:14-253
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ 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`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ production 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! /home/hrace009/.npm/_logs/2020-02-12T15_18_00_891Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ prod: `npm run production`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ prod 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! /home/hrace009/.npm/_logs/2020-02-12T15_18_00_899Z-debug.log
Package.json as bellow
{
"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"
},
"devDependencies": {
"axios": "^0.19",
"bootstrap": "^4.0.0",
"cross-env": "^7.0",
"jquery": "^3.2",
"laravel-mix": "^5.0.1",
"lodash": "^4.17.13",
"popper.js": "^1.12",
"resolve-url-loader": "^2.3.1",
"sass": "^1.20.1",
"sass-loader": "7.*",
"vue": "^2.5.17",
"vue-template-compiler": "^2.6.10"
}
}
anyone can help? thanks
Level 3
I had the same issue last week, its something to do with Bootstrap files.
Here's the solution that worked for me (see the best answer in the following post):
https://laracasts.com/discuss/channels/elixir/npm-run-prod-fails-with-bootstrap?page=1
1 like
Please or to participate in this conversation.