avitkauskas's avatar

[5.4] mix.sass() not working

I have updated my projects Laravel to 5.4 from 5.3. Started using laravel-mix instead of elixir. Everything was working fine but then I have uninstalled laravel-elixir-vue-2 and the mix.sass() started throwing an errors when npm run dev and npm run watch commands were executed. I have tried to reinstall laravel-elixir-vue-2 and "voulia" - mix.sass()works perfectly. Please help me to find out how to fix this problem. Bellow is some information:

webpack.mix.js

let mix = require('laravel-mix');

mix.sass('resources/assets/sass/app.scss', 'public/css/app.css');

npm run dev result:

ERROR  Failed to compile with 1 errors                                                                                                                                                                                                                              3:19:15 PM

This dependency was not found:

* /mnt/oldDev/home/www/name/project/resources/assets/sass/app.scss in multi ./~/laravel-mix/src/mock-entry.js ./resources/assets/sass/app.scss

To install it, you can run: npm install --save /mnt/oldDev/home/www/name/project/resources/assets/sass/app.scss
sset      Size  Chunks             Chunk Names
           mix.js   2.88 kB       0  [emitted]  mix
mix-manifest.json  26 bytes          [emitted]
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] dev: `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 2
npm ERR!
npm ERR! Failed at the [email protected] dev script '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! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the project package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     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! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs project
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls project
npm ERR! There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/server/.npm/_logs/2017-03-15T15_19_15_368Z-debug.log

debug.log

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/bin/npm', 'run', 'dev' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle [email protected]~predev: [email protected]
6 silly lifecycle [email protected]~predev: no script for predev, continuing
7 info lifecycle [email protected]~dev: [email protected]
8 verbose lifecycle [email protected]~dev: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~dev: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/mnt/oldDev/home/www/name/project/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
10 verbose lifecycle [email protected]~dev: CWD: /mnt/oldDev/home/www/name/project
11 silly lifecycle [email protected]~dev: Args: [ '-c',
11 silly lifecycle   'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js' ]
12 silly lifecycle [email protected]~dev: Returned: code: 2  signal: null
13 info lifecycle [email protected]~dev: Failed to exec dev script
14 verbose stack Error: [email protected] dev: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
14 verbose stack Exit status 2
14 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:279:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:192:7)
14 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:192:7)
14 verbose stack     at maybeClose (internal/child_process.js:890:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid [email protected]
16 verbose cwd /mnt/oldDev/home/www/name/project
17 verbose Linux 3.13.0-24-generic
18 verbose argv "/usr/local/bin/node" "/usr/bin/npm" "run" "dev"
19 verbose node v7.6.0
20 verbose npm  v4.4.1
21 error code ELIFECYCLE
22 error errno 2
23 error [email protected] dev: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
23 error Exit status 2
24 error Failed at the [email protected] dev script 'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js'.
24 error Make sure you have the latest version of node.js and npm installed.
24 error If you do, this is most likely a problem with the project package,
24 error not with npm itself.
24 error Tell the author that this fails on your system:
24 error     cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
24 error You can get information on how to open an issue for this project with:
24 error     npm bugs project
24 error Or if that isn't available, you can get their info via:
24 error     npm owner ls project
24 error There is likely additional logging output above.
25 verbose exit [ 2, true ]

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": {
    "lodash": "^4.16.2",
    "vue": "^2.0.1",
    "vue-resource": "^1.0.3",
    "webpack": "^2.2.1",
    "axios": "^0.15.3",
    "cross-env": "^3.2.3",
    "laravel-mix": "^0.8.8",
    "browser-sync": "^2.18.8"
  },
  "name": "project",
  "description": "project",
  "version": "1.0.0",
  "directories": {
    "test": "tests"
  },
  "dependencies": {
    "angular": "^1.6.0",
    "angular-animate": "^1.6.0",
    "angular-cookies": "^1.6.0",
    "angular-i18n": "^1.6.3",
    "angular-loading-bar": "^0.9.0",
    "angular-moment": "^1.0.1",
    "angular-resource": "^1.6.0",
    "angular-route": "^1.6.0",
    "angular-sanitize": "^1.6.0",
    "angular-strap": "^2.3.12",
    "angular-touch": "^1.6.0",
    "angular-translate": "^2.13.1",
    "angular-ui-bootstrap": "^2.3.1",
    "bootstrap-sass": "^3.3.7",
    "css-loader": "^0.27.3",
    "dev": "^0.1.3",
    "font-awesome": "^4.7.0",
    "gulp": "^3.9.1",
    "jquery": "^3.1.0",
    "moment": "^2.17.1",
    "underscore": "^1.8.3"
  },
  "repository": {
    "type": "git",
    "url": "http://dev:8080/name/project.git"
  },
  "author": "name",
  "license": "ISC"
}
0 likes
5 replies
vipin93's avatar

change package.json with this code

 "dev": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "hot": "node node_modules/cross-env/bin/cross-env.js 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": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
avitkauskas's avatar

@vipin93 after updating package.json npm run watch worked perfect but other commands not.

MaverickChan's avatar
Level 47
  1. if you are using MAC , node version is not important , but in windows , use v6 not v7.
  2. npm install reinstall --save
  3. npm reinstall
  4. npm update
2 likes

Please or to participate in this conversation.