spatie / laravel-mix-purgecss

Zero-config Purgecss for Laravel Mix
https://spatie.be/en/opensource
MIT License
874 stars 38 forks source link

Windows 10 - NPM won't compile #6

Closed sunscreem closed 6 years ago

sunscreem commented 6 years ago

This looks like a great package.

However - here's what I get when I try and run npm dev or npm prod as soon as I add require('laravel-mix-purgecss'); to webpack.mix.js.

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\ROBWORK\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'production' ]
2 info using npm@3.9.5
3 info using node@v6.10.0
4 verbose run-script [ 'preproduction', 'production', 'postproduction' ]
5 info lifecycle @~preproduction: @
6 silly lifecycle @~preproduction: no script for preproduction, continuing
7 info lifecycle @~production: @
8 verbose lifecycle @~production: unsafe-perm in lifecycle true
9 verbose lifecycle @~production: PATH: C:\Users\ROBWORK\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;C:\www\eventFx\node_modules\.bin;C:\Program Files\nodejs;C:\Users\ROBWORK\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\ROBWORK\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Skype\Phone;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\nodejs;C:\ProgramData\ComposerSetup\bin;C:\HashiCorp\Vagrant\bin;C:\Program Files (x86)\GnuPG\bin;C:\Program Files\Git\cmd;C:\Users\ROBWORK\AppData\Local\Microsoft\WindowsApps;C:\dev\php;C:\dev\bin;C:\Users\ROBWORK\AppData\Local\GitHubDesktop\bin;C:\Program Files\Microsoft VS Code\bin;C:\Users\ROBWORK\AppData\Roaming\Composer\vendor\bin;C:\Users\ROBWORK\AppData\Local\Microsoft\WindowsApps;C:\Users\ROBWORK\AppData\Roaming\npm;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
10 verbose lifecycle @~production: CWD: C:\www\eventFx
11 silly lifecycle @~production: Args: [ '/d /s /c',
11 silly lifecycle   'cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js' ]
12 silly lifecycle @~production: Returned: code: 1  signal: null
13 info lifecycle @~production: Failed to exec production script
14 verbose stack Error: @ production: `cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (C:\Users\ROBWORK\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:245:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (C:\Users\ROBWORK\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:24:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:877:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid @
16 verbose cwd C:\www\eventFx
17 error Windows_NT 10.0.16299
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ROBWORK\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "production"
19 error node v6.10.0
20 error npm  v3.9.5
21 error code ELIFECYCLE
22 error @ production: `cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
22 error Exit status 1
23 error Failed at the @ production script 'cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the  package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Here's my package.json:

{
  "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": "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": "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 --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
  },
  "devDependencies": {
    "axios": "^0.17",
    "bootstrap-sass": "^3.3.7",
    "cross-env": "^5.1",
    "jquery": "^3.2",
    "laravel-mix": "^2.0",
    "lodash": "^4.17.4",
    "vue": "^2.5.7"
  }
}

Kinda stuck on where to start debugging here?

sebastiandedeyne commented 6 years ago

I think this might be an issue with me using syntax that's not supported by Node 6.x yet. I just tagged 1.0.3-beta.1, could you give that version a try?

sunscreem commented 6 years ago

Perfect!

Works a treat now. 177kB reduced to 79kB - lovely :)

sebastiandedeyne commented 6 years ago

Perfect! I released 1.0.3 so you can revert to a stable version number now :)