laravel-mix / laravel-mix

The power of webpack, distilled for the rest of us.
MIT License
5.27k stars 810 forks source link

Upgrading to Laravel 5.4 and Spark 4.0 fails #267

Closed Konafets closed 7 years ago

Konafets commented 7 years ago

I tried to upgrade from 5.3 to 5.4 following the Laravels and Sparks upgrade guides. When running $ npm run dev I got the following error

 ERROR  Failed to compile with 1 errors

 error  in ./resources/assets/less/app.less

Module parse failed: /Users/user/Sites/project/dev/htdocs/resources/assets/less/app.less Unexpected character '@' (1:0)
You may need an appropriate loader to handle this file type.
| @import "./../../../node_modules/bootstrap/less/bootstrap";
|
| // @import "./spark/spark";

 @ multi /js/app

               Asset      Size  Chunks             Chunk Names
          /js/app.js   1.34 MB       0  [emitted]  /js/app
   mix-manifest.json  32 bytes          [emitted]
js/sweetalert.min.js     17 kB          [emitted]
  css/sweetalert.css   22.9 kB          [emitted]

npm ERR! Darwin 15.6.0
npm ERR! argv "/Users/user/.nvm/versions/node/v6.9.0/bin/node" "/Users/user/.nvm/versions/node/v6.9.0/bin/npm" "run" "dev"
npm ERR! node v6.9.0
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! @ dev: `node node_modules/cross-env/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`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ dev script 'node node_modules/cross-env/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'.
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  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node node_modules/cross-env/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
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/user/Sites/project/dev/htdocs/npm-debug.log

Used config file is the one I got via $ npm install

This is how package.json looks like

{
  "private": true,
  "scripts": {
    "dev": "node node_modules/cross-env/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/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"
  },
  "dependencies": {
    "bootstrap": "^3.0.0",
    "jquery": "^2.1.4",
    "js-cookie": "^2.1.0",
    "laravel-mix": "^0.5.0",
    "moment": "^2.10.6",
    "promise": "^7.1.1",
    "sweetalert": "^1.1.3",
    "underscore": "^1.8.3",
    "urijs": "^1.17.0",
    "vue": "~2.0.1",
    "axios": "^0.15.2"
  }
}
Konafets commented 7 years ago

I solved it by myself. During $ npm install I spotted

/Users/username/Sites/project/dev/htdocs
└─┬ laravel-mix@0.6.0
  └── UNMET PEER DEPENDENCY webpack@2.2.1

After installing webpack 2.2.1 manually I was able to compile the assets down.