gruntjs / grunt

Grunt: The JavaScript Task Runner
http://gruntjs.com/
Other
12.27k stars 1.5k forks source link

Grunt crashes with Node 10.14.2 #1658

Closed ahmetcetin closed 5 years ago

ahmetcetin commented 5 years ago

When using node 10.14.2, it crashes with "ReferenceError: internalBinding is not defined"

shama commented 5 years ago

I'm not seeing that error with node 10.14.2. If possible could you provide your package.json and Gruntfile.js?

ahmetcetin commented 5 years ago

Sure, here is package.json:

{
  "name": "composer",
  "private": true,
  "version": "0.0.147",
  "main": "server/server.js",
  "devDependencies": {
    "angular-mocks": "1.5.0",
    "babel-preset-es2015": "^6.14.0",
    "better-npm-run": "0.0.8",
    "chai": "^3.5.0",
    "eslint": "^3.8.0",
    "eslint-config-airbnb": "^10.0.1",
    "eslint-plugin-import": "^1.14.0",
    "eslint-plugin-jsx-a11y": "^2.2.0",
    "eslint-plugin-react": "^6.2.0",
    "gmsmith": "^1.1.2",
    "grunt": "^1.0.1",
    "grunt-angular-templates": "^0.5.7",
    "grunt-autoprefixer": "^2.0.0",
    "grunt-aws": "^0.6.1",
    "grunt-babel": "^6.0.0",
    "grunt-bg-shell": "^2.3.3",
    "grunt-cache-busting": "0.0.11",
    "grunt-concurrent": "^1.0.0",
    "grunt-confirm": "^1.0.4",
    "grunt-contrib-clean": "^0.6.0",
    "grunt-contrib-concat": "^1.0.1",
    "grunt-contrib-connect": "^0.9.0",
    "grunt-contrib-copy": "^0.7.0",
    "grunt-contrib-cssmin": "^0.12.0",
    "grunt-contrib-htmlmin": "^0.4.0",
    "grunt-contrib-imagemin": "^0.9.4",
    "grunt-contrib-jshint": "^0.11.0",
    "grunt-contrib-less": "^1.0.1",
    "grunt-contrib-uglify": "^2.3.0",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-docco": "^0.4.0",
    "grunt-env": "^0.4.4",
    "grunt-exec": "^1.0.1",
    "grunt-inline-css": "^1.0.0",
    "grunt-jsdoc": "^1.0.0",
    "grunt-karma": "*",
    "grunt-newer": "^1.1.0",
    "grunt-ng-annotate": "^0.9.2",
    "grunt-ng-constant": "^1.1.0",
    "grunt-open": "^0.2.3",
    "grunt-preprocess": "^5.1.0",
    "grunt-protractor-runner": "^5.0.0",
    "grunt-remove-logging": "^0.2.0",
    "grunt-remove-logging-calls": "^0.1.2",
    "grunt-replace": "^0.11.0",
    "grunt-responsive-images": "^0.1.7",
    "grunt-spritesmith": "^6.0.0",
    "grunt-svgmin": "^2.0.0",
    "grunt-svgstore": "^1.0.0",
    "grunt-usemin": "^3.0.0",
    "jit-grunt": "^0.9.1",
    "jscs": "^3.0.7",
    "jshint": "^2.5.6",
    "jshint-stylish": "^1.0.0",
    "karma": "^0.13.22",
    "karma-chai": "^0.1.0",
    "karma-mocha": "^0.2.2",
    "karma-phantomjs-launcher": "*",
    "karma-read-json": "^1.1.0",
    "karma-sinon": "^1.0.4",
    "karma-spec-reporter": "0.0.26",
    "load-grunt-configs": "^0.4.3",
    "load-grunt-tasks": "^3.3.0",
    "mocha": "^2.4.5",
    "nock": "^9.1.3",
    "nodemon": "^1.11.0",
    "nsp": "^2.1.0",
    "nyc": "^11.3.0",
    "phantomjs-prebuilt": "^2.1.7",
    "protractor-browser-logs": "^1.0.351",
    "protractor-jasmine2-html-reporter": "0.0.6",
    "q": "^1.4.1",
    "sinon": "^1.17.3",
    "supertest": "^1.2.0",
    "time-grunt": "^1.0.0",
    "uglify-js": "2.7.5"
  },
  "dependencies": {
    "angular": "1.5.3",
    "angular-animate": "1.5.3",
    "angular-aria": "1.5.0",
    "angular-chart.js": "^1.1.1",
    "angular-cookies": "1.5.0",
    "angular-credit-cards": "https://github.com/bendrucker/angular-credit-cards",
    "angular-dragdrop": "^1.0.13",
    "angular-messages": "1.5.0",
    "angular-moment": "^1.2.0",
    "angular-perfect-scrollbar": "https://github.com/itsdrewmiller/angular-perfect-scrollbar",
    "angular-recaptcha": "^4.1.2",
    "angular-sanitize": "1.5.0",
    "angular-stripe": "https://github.com/bendrucker/angular-stripe",
    "angular-ui-bootstrap": "^2.5.0",
    "angular-ui-router": "1.0.3",
    "angular-utils-pagination": "^0.11.1",
    "angularjs-color-picker": "^3.1.1",
    "archiver": "^1.3.0",
    "async": "^2.0.1",
    "aws-sdk": "^2.67.0",
    "base64-arraybuffer": "^0.1.5",
    "body-parser": "^1.15.0",
    "bootstrap": "^3.2.0",
    "bunyan": "^1.8.10",
    "bunyan-elasticsearch": "^1.0.1",
    "callsite": "^1.0.0",
    "clipboard": "^1.7.1",
    "cls-hooked": "^4.1.7",
    "compression": "^1.0.3",
    "cors": "^2.8.1",
    "debug": "^2.2.0",
    "dw-log-module": "git+https://wbm-buildaccount:lb9dGtAo2pFf@bitbucket.org/wbmgeneral/dw-log-module.git",
    "elasticsearch": "^13.0.1",
    "errorhandler": "^1.4.3",
    "express-session": "^1.14.2",
    "fabric": "2.3.6",
    "file-saver": "^1.3.3",
    "fs-extra": "^7.0.0",
    "gm": "^1.23.0",
    "helmet": "^1.3.0",
    "homeless": "^1.4.1",
    "hone": "^1.0.3",
    "http-aws-es": "^1.1.3",
    "hubspot": "^1.3.4",
    "joi": "^10.0.6",
    "jquery": "^3.2.1",
    "jquery-ui-dist": "^1.12.1",
    "json2csv": "^4.1.6",
    "karma-es6-shim": "^1.0.0",
    "lodash": "^4.17.4",
    "loopback": "^2.39.1",
    "loopback-boot": "^2.6.5",
    "loopback-component-explorer": "^2.4.0",
    "loopback-connector-mysql": "^2.2.1",
    "loopback-connector-redisnext": "^0.0.6",
    "loopback-context": "^1.0.0",
    "loopback-datasource-juggler": "^2.39.0",
    "loopback-ds-timestamp-mixin": "^3.2.2",
    "md5": "^2.1.0",
    "md5-jkmyers": "0.0.1",
    "mime-types": "^2.1.7",
    "moment": "^2.7.0",
    "mysql2": "^1.5.2",
    "ng-device-detector": "^3.0.1",
    "ng-file-upload": "^12.2.13",
    "ng-infinite-scroll": "^1.3.0",
    "nodemailer-ses-transport": "^1.3.0",
    "opentype.js": "^0.7.3",
    "passport": "^0.3.2",
    "passport-facebook": "^2.1.1",
    "passport-google-oauth20": "^1.0.0",
    "perfect-scrollbar": "0.6",
    "pug": "^2.0.0-beta4",
    "redis": "^2.6.3",
    "s3": "^4.4.0",
    "s3-download-stream": "^1.1.1",
    "serve-favicon": "^2.0.1",
    "sqs-consumer": "^3.3.0",
    "sqs-producer": "^1.4.0",
    "stripe": "^4.10.0",
    "superagent": "^3.2.0",
    "superagent-cache": "^1.4.1",
    "superagent-mocker": "^0.5.2",
    "superagent-promise-plugin": "^3.2.0",
    "universal-analytics": "^0.4.20",
    "uuid": "^2.0.2",
    "verror": "^1.8.1",
    "wbm-assets-url": "https://wbm-buildaccount:lb9dGtAo2pFf@bitbucket.org/wbmgeneral/assets-url.git",
    "webfontloader": "^1.6.28"
  },
  "repository": {
    "type": "",
    "url": ""
  },
  "engine": "node 6.2.2",
  "scripts": {
    "start": "node server/server.js --harmony",
    "test": "better-npm-run test",
    "testr": "better-npm-run testr",
    "jenkinsTest": "better-npm-run jenkinsTest",
    "testmine": "better-npm-run testmine",
    "local": "better-npm-run local",
    "devdocker": "better-npm-run devdocker",
    "development": "better-npm-run development",
    "docker-up": "cd ../DW_docker && docker-compose up -d",
    "docker-down": "cd ../DW_docker && docker-compose stop"
  },
  "betterScripts": {
    "test": {
      "command": "nyc --reporter=text-summary node_modules/.bin/mocha --ui bdd --timeout 30000 test_api/**/*.test.js",
      "env": {
        "NODE_ENV": "test"
      }
    },
    "testr": {
      "command": "nyc node_modules/.bin/mocha --ui bdd --timeout 30000 --reporter spec test_api/models/user.test.js",
      "env": {
        "NODE_ENV": "test"
      }
    },
    "jenkinsTest": {
      "command": "nyc node_modules/.bin/mocha --ui bdd --timeout 120000 --reporter spec test_api/**/*.test.js",
      "env": {
        "NODE_ENV": "jenkins"
      }
    },
    "testmine": {
      "command": "mocha --ui bdd --timeout 10000 --reporter spec test_api/testConfig.js test_api/models/composition.test.js",
      "env": {
        "NODE_ENV": "test"
      }
    },
    "local": {
      "command": "nodemon | bunyan",
      "env": {
        "NODE_ENV": "local"
      }
    },
    "devdocker": {
      "command": "nodemon | bunyan",
      "env": {
        "NODE_ENV": "devdocker"
      }
    },
    "development": {
      "command": "nodemon | bunyan",
      "env": {
        "NODE_ENV": "development"
      }
    }
  }
}

and here goes Gruntfile.js:

'use strict';

module.exports = function(grunt) {
  //Dependencies
  require('load-grunt-tasks')(grunt); // task loader - takes all requested tasks from config directory
  require('time-grunt')(grunt); // by that task we can see time required for running each task
  var config = {
    config: {
      src: 'config/grunt/*.js', // this property change the directory where tasks resides
    },
    composer: {
      app: 'app', // our development directory
      dist: 'dist', // here we set the name of the build directory
      temp: '.tmp', // temp directory is used by different tasks like less compiling process used during sprite positioning
      chromeDriverVersion: '2.41',
      // seleniumServerVersion: process.platform === 'linux' ? '2.53.1' : '3.3.1',
      seleniumServerVersion: '3.12.0',
      /**
       * NB: update version in config.js (jvmArgs) if this is updated
       */
      geckoDriverVersion: 'v0.13.0',
    },
  };

  config = require('load-grunt-configs')(grunt, config); // task required to take the tasks from separate files from config directory
  grunt.initConfig(config);
  grunt.loadTasks('tasks');

  // by that task we can view our application in browser
  grunt.registerTask(
    'servelocal',
    'Compile then start a connect web server',
    () => {
      grunt.task.run(['bgShell:watch', 'bgShell:runNodelocal']);
    }
  );

  // by that task we can view our application in browser
  grunt.registerTask('serve', 'Compile then start a connect web server', () => {
    grunt.task.run(['bgShell:watch', 'bgShell:runNodedocker']);
  });

  grunt.registerTask(
    'servelocal',
    'Compile then start a connect web server',
    () => {
      grunt.task.run(['bgShell:watch', 'bgShell:runNodelocal']);
    }
  );

  grunt.registerTask(
    'server',
    'DEPRECATED TASK. Use the "serve" task instead',
    function(target) {
      grunt.log.warn(
        'The `server` task has been deprecated. Use `grunt serve` to start a server.'
      );
      grunt.task.run(['serve:' + target]);
    }
  );

  grunt.registerTask('buildDev', [
    'ngconstant:development',
    'build',
    'env:dev',
    'preprocess:dev',
  ]);

  grunt.registerTask('buildDocker', [
    'ngconstant:devdocker',
    'build',
    'env:devdocker',
    'preprocess:dev',
  ]);

  grunt.registerTask('buildProd', [
    'ngconstant:production',
    'build',
    'env:prod',
    'preprocess:dev',
  ]);

  grunt.registerTask('e2e', 'E2E tests for different environments', function(
    env
  ) {
    grunt.task.run('exec', 'protractor');
  });

  grunt.registerTask('test', ['karma']);

  grunt.registerTask('email', [
    'less:email',
    'copy:email',
    'inlinecss',
    'connect:test',
    'watch:email',
  ]);

  //preparing graphics like sprites and creates different sizes of images - works for icons and logos
  grunt.registerTask('prepare-graphics', [
    'responsive_images:icons',
    'responsive_images:logos',
    'responsive_images:touchIcons',
    'sprite:icons22',
    'sprite:icons30',
    'sprite:icons44',
    'sprite:icons88',
    'sprite:iconsWhite30',
    'sprite:iconsWhite36',
    'sprite:iconsWhite44',
    'sprite:iconsWhite88',
    'sprite:iconsBlack30',
    'sprite:iconsBlack36',
    'sprite:iconsBlack44',
    'sprite:iconsBlack88',
    'sprite:iconsGreen30',
    'sprite:iconsGreen36',
    'sprite:iconsGreen44',
    'sprite:iconsGreen88',
  ]);

  //by running
  grunt.registerTask('build', [
    'clean:dist', //this task checks and cleans up the dist folder
    'copyright:dist',
    // 'useminPrepare', // works with usemin to minify html, css or js files
    'concurrent:dist', // we use it for images or svg files minification
    'autoprefixer', // adds vendor specifix prefixes like -webkit- or -moz to the css files
    'ngtemplates',
    'concat',
    'svgstore',
    'ngAnnotate', // fixing angulars dependency injection issue
    'less:dist', // compling less file into minified css
    'copy:dist', // copy files from app and tmp to the dist folder
    // 'imagemin:dist',
    'uglify', // combining js files into one
    'cache-busting',
    'htmlmin', // minifies html files
  ]);

  grunt.registerTask('buildJenkins', ['buildProd', 'clean:maps']);

  grunt.registerTask('default', ['buildDocker']);
};
ahmetcetin commented 5 years ago

both of these two tasks are failing with "ReferenceError: internalBinding is not defined" in node 10.14.2, it works with 10.14.1 though:

  grunt.registerTask('buildDocker', [
    'ngconstant:devdocker',
    'build',
    'env:devdocker',
    'preprocess:dev',
  ]);

  grunt.registerTask('buildProd', [
    'ngconstant:production',
    'build',
    'env:prod',
    'preprocess:dev',
  ]);
ahmetcetin commented 5 years ago

I found this issue in node, same problem with gulp: https://github.com/nodejs/node/issues/24985

shama commented 5 years ago

It looks like this is an issue with the natives package and it needs to be updated. You can force it with npm i natives@1.1.6.

Grunt doesn't have natives as a dependency so I don't think this is related to Grunt. The plugin grunt-cache-busting however does have it as a dependency tagged with ^1.1.0. So you may just need to delete your package-lock.json, rm -rf node_modules and npm i again to get the latest version.

davidrmckinnon commented 5 years ago

Thanks @shama. Deleting my package-lock.json, rm -rf node_modules and npm i worked for me