stefanjudis / grunt-phantomas

Grunt plugin wrapping phantomas to measure frontend performance
MIT License
285 stars 25 forks source link

node-sass@3.3.3 Error #162

Closed marcus-at-localhost closed 7 years ago

marcus-at-localhost commented 7 years ago

Hi, is there a chance to get this updated? The installation fails with

6797 verbose stack Error: node-sass@3.3.3 postinstall: `node scripts/build.js`
6797 verbose stack Exit status 1
6797 verbose stack     at EventEmitter.<anonymous> (e:\xampp\nodejs\node_modules\npm\lib\utils\lifecycle.js:279:16)
6797 verbose stack     at emitTwo (events.js:106:13)
6797 verbose stack     at EventEmitter.emit (events.js:191:7)
6797 verbose stack     at ChildProcess.<anonymous> (e:\xampp\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
6797 verbose stack     at emitTwo (events.js:106:13)
6797 verbose stack     at ChildProcess.emit (events.js:191:7)
6797 verbose stack     at maybeClose (internal/child_process.js:877:16)
6797 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
6798 verbose pkgid node-sass@3.3.3
6799 verbose cwd E:\WEB\marcus-obst.de
6800 error Windows_NT 10.0.14393
6801 error argv "e:\\xampp\\nodejs\\node.exe" "e:\\xampp\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "grunt-phantomas" "--save-dev"
6802 error node v6.9.2
6803 error npm  v4.0.5
6804 error code ELIFECYCLE
6805 error node-sass@3.3.3 postinstall: `node scripts/build.js`
6805 error Exit status 1
6806 error Failed at the node-sass@3.3.3 postinstall script 'node scripts/build.js'.
6806 error Make sure you have the latest version of node.js and npm installed.
6806 error If you do, this is most likely a problem with the node-sass package,
6806 error not with npm itself.
6806 error Tell the author that this fails on your system:
6806 error     node scripts/build.js
6806 error You can get information on how to open an issue for this project with:
6806 error     npm bugs node-sass
6806 error Or if that isn't available, you can get their info via:
6806 error     npm owner ls node-sass
6806 error There is likely additional logging output above.
6807 verbose exit [ 1, true ]

I guess this is related to node-sass and new node/npm version, but I have no idea how to solve this.

Hope there is a way to get this running.

Thanks.

stefanjudis commented 7 years ago

@marcus-at-localhorst

I assume npm i node-sass@3.3.3 fails, too?

Maybe a dependency update helps? So you can clone this repo and run npm i inside of it. You should see the same behavior.

Then update the dependencies manually and see if one updates helps. I'd give updating grunt-contrib-compass the first shot... :)

marcus-at-localhost commented 7 years ago

Thanks for the advice. I think I got it running by trial and error. I updated "grunt-contrib-compass": "^1.1.1", and "phantomas": "~1.18.0", (earlier version failed to build or something).

So I am able to run the task with this output:

Running "phantomas:gruntSite" (phantomas) task

PHANTOMAS EXECUTION(S) STARTED.
>>5 Phantomas execution(s) done -> checking results:
>>Phantomas execution not successful -> [object Object]
>>Phantomas execution not successful -> [object Object]
>>Phantomas execution not successful -> [object Object]
>>Phantomas execution not successful -> [object Object]
>>Phantomas execution not successful -> [object Object]

WRITING RESULT FILES.
>> SOMETHING WENT WRONG...
>> No run was successful.

Maybe the latest Phantomas version causes it to fail? Any idea what else to try?

stefanjudis commented 7 years ago

@marcus-at-localhorst

Please provide your grunt configuration, node version and specific installed dependencies. :) Without that information it's just wild guessing. ;)

I have to be able to reproduce it. :)

marcus-at-localhost commented 7 years ago

I installed grunt-phantomas again (package.json at the end), without any errors. This is my (stripped down) gruntfile.js (using https://www.npmjs.com/package/jit-grunt to load plugins, if that matters). Output is the same. /phantomas/data/ directory gets created but is empty.

Node/NPM Version:

node v6.9.2
npm  v4.0.5
module.exports = function (grunt) {

    require('time-grunt')(grunt);
    // just in time grunt
    require('jit-grunt')(grunt);

    // -- Init
    grunt.initConfig({

        // ---- Vars
        pkg: grunt.file.readJSON('package.json'),

        template_path: "pico/themes/default",
        phantomas: {
            gruntSite : {
                options : {
                    indexPath : './phantomas/',
                    options   : {},
                    url       : 'http://gruntjs.com/',
                    buildUi   : true
                }
            }
        },

        // ---- Tasks
        watch: {
            options: {
                spawn: false,
            },
            less: {
                files:['<%= template_path %>/less/*.less'],
                tasks:['newer:less:development','newer:postcss','cssmin']
            }
        }
    });

    // -- Watch Event
    grunt.event.on('watch', function(action, filepath, target) {
        grunt.log.writeln(target + ': ' + filepath + ' has ' + action);
    });

    // -- Register Task
    grunt.registerTask('default', ['less:development','postcss','cssmin']);
    grunt.registerTask('js', ['uglify']);
    grunt.registerTask('svg', ['svgmin']);

};

package.json (stripped down)

  "devDependencies": {
    "analyze-css": "^0.12.4",
    "autoprefixer": "^6.6.0",
    "grunt": "^0.4.5",
    "grunt-contrib-compass": "^1.1.1",
    "grunt-contrib-cssmin": "^0.13.0",
    "grunt-contrib-less": "^1.4.0",
    "grunt-contrib-uglify": "^2.0.0",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-criticalcss": "^2.1.0",
    "grunt-cssbeautifier": "^0.1.2",
    "grunt-csso": "0.6.5",
    "grunt-newer": "^1.1.1",
    "grunt-phantomas": "^0.13.0",
    "grunt-postcss": "^0.6.0",
    "grunt-svgmin": "^4.0.0",
    "jit-grunt": "^0.9.1",
    "matchdep": "^0.3.0",
    "postcss": "^5.2.7",
    "request": "2.25.0",
    "time-grunt": "^1.2.1"
  }

updated grunt-phantomas package.json

{
  "name": "grunt-phantomas",
  "description": "Grunt plugin for phantomas",
  "version": "0.12.1",
  "homepage": "https://github.com/stefanjudis/grunt-phantomas",
  "author": {
    "name": "stefan judis",
    "email": "stefanjudis@gmail.com",
    "url": "http://stefanjudis.de"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/stefanjudis/grunt-phantomas.git"
  },
  "bugs": {
    "url": "https://github.com/stefanjudis/grunt-phantomas/issues"
  },
  "licenses": [
    {
      "type": "MIT",
      "url": "https://github.com/stefanjudis/grunt-phantomas/blob/master/LICENSE-MIT"
    }
  ],
  "main": "Gruntfile.js",
  "engines": {
    "node": ">= 0.8.0"
  },
  "scripts": {
    "test": "grunt test",
    "coveralls": "jscoverage tasks/lib/phantomas.js && PHANTOMAS_COV=1 nodeunit --reporter=lcov test/lib/phantomasTest.js | coveralls"
  },
  "devDependencies": {
    "coveralls": "~2.11.0",
    "grunt": "^0.4.5",
    "grunt-contrib-clean": "~0.6.0",
    "grunt-contrib-compass": "^1.1.1",
    "grunt-contrib-copy": "~0.5.0",
    "grunt-contrib-jshint": "~0.10.0",
    "grunt-contrib-nodeunit": "~0.4.0",
    "grunt-contrib-uglify": "~0.5.0",
    "grunt-contrib-watch": "~0.6.0",
    "grunt-jscs": "^0.7.1",
    "jscoverage": "~0.5.0-rc1",
    "nodeunit": "~0.9.0"
  },
  "peerDependencies": {
    "grunt": ">=0.4.0"
  },
  "keywords": [
    "gruntplugin",
    "phantomas",
    "performance",
    "metrics",
    "phantomjs"
  ],
  "dependencies": {
    "bluebird": "~2.3.0",
    "phantomas": "~1.18.0",
    "node-fs": "~0.1.7",
    "lodash": "~2.4.1",
    "html-minifier": "~0.6.0",
    "json2csv": "~2.2.1"
  }
}

Thanks!

stefanjudis commented 7 years ago

I'll try to have a look, feel free to remind me in a few days in case I forgot.

marcus-at-localhost commented 7 years ago

I will! I tried to debug it, but I have no clue how to debug promises and objects on a cli :). I suspect phantomas() call returns nothing. Although, I can use phantomas https://github.com/macbre/phantomas --verbose --runs 5 on cli. (because I also installed phantomas globally). I am on Windows.

stefanjudis commented 7 years ago

I'll updated all dependencies and try to solve to more issues today...

Let me know in case you run into further troubles. :)

marcus-at-localhost commented 7 years ago

Thanks for your work. I was able to install it without errors (but only if I add "grunt-phantomas": "~0.12.2", in my local package.json - npm install grunt-phantomas --save-dev pulls version 0.13.0 which is older).

Unfortunately the grunt task is still not working.

DEBUG=* grunt phantomas -v

phantomas:results Process returned code #255
phantomas:results Error when parsing JSON (SyntaxError: Unexpected end of JSON input):""
phantomas:results Rejecting a promise with 255 exit code
...

So I guess phantomas is making trouble and doesn't return anything

stefanjudis commented 7 years ago

aaah sh... .

Sorry I made a mistake in the release... it should have be 0.14.0.

Let me release another version. Will be there in 5min. Sorry for inconvenience.

stefanjudis commented 7 years ago

Okay. I released 0.14.0. It's not visible at npm for me but should appear soon. Can you try again?

marcus-at-localhost commented 7 years ago

Installation works well now. Thank you so much.

Do you have an idea how to debug the phantomas 255 error?

stefanjudis commented 7 years ago

Open another issue and add the full output of grunt-phantomas, grunt config for phantomas and node version.

Also executing the cli of phantomas itself and check if the same error appears there. :)

https://github.com/macbre/phantomas

marcus-at-localhost commented 7 years ago

Hey, just a quick note about the error 255 I got on Windows platform, even after your fixes.

It turned out that the round brackets in the user-agent field need to be escaped. Details here: https://github.com/macbre/phantomas/issues/687

Until this is fixed in phantomas you should put a properly escaped (^^)) user-agent in grunt-phantomas or leave round brackets off.

phantomas: {
    gruntSite : {
        options : {
            indexPath : './phantomas/',
            options   : {
                'film-strip':false,
                'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64^^) AppleWebKit/537.36 (KHTML, like Gecko^^) Chrome/57.0.2987.37 Safari/537.36'
            },
            url       : 'http://google.com/',
            buildUi   : true
        }
    }
},

I really like grunt-phantomas. What's the reason you stopped developing it? Do you use something else? Did it fail in some way? (Beside that there is maybe not enough time for development)

Cheers.

stefanjudis commented 7 years ago

@marcus-at-localhorst

What's the reason you stopped developing it?

Well... Life I guess.

I got another job with a different stack. I've never made it to make this project task runner independent (shouldn't be too hard though). And that's why I stopped using it myself. Which meant that the prio went down.

I was always looking/asking for help, which didn't work (still looking for contributors ;) ).

So I think it's the usual open source project story. ;)

Did it fail in some way?

Don't think so. Surely there are other tools out there, but I think it's still a good tool. :)

marcus-at-localhost commented 7 years ago

@stefanjudis thanks for the insight and good luck!